Jump to content

navigate buttons


xbl1

Recommended Posts

Hi;I am trying to write a list navigate battons for the user navigate differet web page, it is like 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 variable function nextFunction(mystr) { myChar=mystr; window.setTimeout("delayit()", 1000); } function delayit() { if(myChar=='<'){ //it has reaction here 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=='>'){//it has reaction here 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 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 variable function 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...