Jump to content

the navigate buttons problem


xbl1
 Share

Recommended Posts

Hi;I am trying to write a list navigate battons for the user navigate differet web page,it is like the bottom of the buttons of this forum does.For example, a list a buttons of the '<', '1', '2', '3' and '>', user could use it to navigatewith different page.The problem i have is there are not reaction from the buttons of the '1', '2' and '3',when i click on these buttons, but the buttons of the '<' and '>' works fine.Could you help me to find out problem, please.all the work i have done as following:in the .htaccess, i wrote a modrewrite rule.

RewriteEngine OnRewriteRule ^country/([0-9]+)/$ /Category.php?page=$1 [L]
and the i wrote some code for these buttons.
<input type="button" id="b<" name="b<" value="<" onClick="nextFunction('<')" /><input type="button" id="b1" name="b1" value="1" onClick="nextFunction('1')" /><input type="button" id="b2" name="b2" value="2" onClick="nextFunction('2')" /><input type="button" id="b3" name="b3" value="3" onClick="nextFunction('3')" /><input type="button" id="b>" name="b>" value=">" onClick="nextFunction('>')" />//////////////////////////////////////////<?php$category= $_SERVER['REQUEST_URI'];$cat=explode("/", $category);$myStr=$cat[1];?>///////////////////////////////////////////<script type="text/javascript">var myChar; // global variablefunction nextFunction(mystr) {myChar=mystr;window.setTimeout("delayit()", 1000);//do you think the problem from set the time out??}function delayit() {if(myChar=='<'){ //it has reaction herenewV1=document.getElementById('b1');newV1.value=parseInt(newV1.value);if(newV1.value==1)return;else{//it has reaction herenewV1.value=parseInt(newV1.value)-1;var newV2=document.getElementById('b2');newV2.value=parseInt(newV2.value)-1;var newV3=document.getElementById('b3');newV3.value=parseInt(newV3.value)-1;}}else if (myChar=='>'){newV1=document.getElementById('b1');newV1.value=parseInt(newV1.value)+1;var newV2=document.getElementById('b2');newV2.value=parseInt(newV2.value)+1;var newV3=document.getElementById('b3');newV3.value=parseInt(newV3.value)+1;}else{window.location.href = "/" + "<?php print($myStr) ?>" + "/" + myChar + "/";}// this part does not has reaction.????????????????????????????????????}</script>
/////////////////////////////////////////////////////////////////////////////////But if i rewrite the javascript code to following, and the rest do not change,it does job, i do not knwon why.
<input type="button" id="b<" name="b<" value="<" onClick="nextFunction('<')" /><input type="button" id="b1" name="b1" value="1" onClick="pageFunction('1')" /><input type="button" id="b2" name="b2" value="2" onClick="pageFunction('2')" /><input type="button" id="b3" name="b3" value="3" onClick="pageFunction('3')" /><input type="button" id="b>" name="b>" value=">" onClick="nextFunction('>')" />////////////////////////////////////////<?php$category= $_SERVER['REQUEST_URI'];$cat=explode("/", $category);$myStr=$cat[1];?>///////////////////////////////////////////<script type="text/javascript">function pageFunction(myChar){window.location.href = "/" + "<?php print($myStr) ?>" + "/" + myChar + "/";}</script>//////////////////////////<script type="text/javascript">var myChar; // global variablefunction nextFunction(mystr) {myChar=mystr;window.setTimeout("delayit()", 1000);}function delayit() {if(myChar=='<'){newV1=document.getElementById('b1');newV1.value=parseInt(newV1.value);if(newV1.value==1)return;else{newV1.value=parseInt(newV1.value)-1;var newV2=document.getElementById('b2');newV2.value=parseInt(newV2.value)-1;var newV3=document.getElementById('b3');newV3.value=parseInt(newV3.value)-1;}}else if (myChar=='>'){newV1=document.getElementById('b1');newV1.value=parseInt(newV1.value)+1;var newV2=document.getElementById('b2');newV2.value=parseInt(newV2.value)+1;var newV3=document.getElementById('b3');newV3.value=parseInt(newV3.value)+1;}}</script>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...