Forum Moderators: open

Message Too Old, No Replies

Go to url with value from input type text

         

Dragosh

12:58 pm on Aug 11, 2007 (gmt 0)

10+ Year Member





echo "

<input type=\"text\" id=\"inputnumber\" value=\"\" />
<input type=\"button\" value=\"Go\" onclick=\"javascript:window.location='". $_SERVER['PHP_SELF'] . "?pagenum=document.getElementById('pagenumberinput').value;\" />";


When i click on Go button nothing happens.
For example in the input field i typed 2. When i press Go i should go to page localhost/facts/pagination2.php?pagenum=2 but it doesnt happen like that. when i press go nothing happens.
I looked at the output source code. it looks like that :

<input id="pagenumberinput" type="text" /><input type="button" value="Go" onclick="javascript:window.location='/facts/pagination2.php?pagenum=document.getElementById('pagenumberinput').value;" />

Any ideas how to correct this?

daveVk

2:06 pm on Aug 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The getElementById bit needs to out of the qoutes like

onclick="javascript:window.location='/facts/pagination2.php?pagenum='+document.getElementById('pagenumberinput').value;"

Dragosh

2:25 pm on Aug 11, 2007 (gmt 0)

10+ Year Member



daveVk you're a genius!
billion thanks. ha, i didnt even thought of that!
thanks again, that really solved my problem.