justravis Posted August 23, 2007 Share Posted August 23, 2007 i am trying to pass the value of the req feild to reqfeilds req writes OK, but reqfeilds does not. thoughts? THANKS! <html> <head> <script type="text/javascript"> function getValue() { document.write(document.getElementById('req').value + '<br>'); var reqfeilds = document.getElementById('req').value; document.write(reqfeilds + '<br>'); } </script> </head> <body> <input type=hidden id=req value='name,email'> <input type=button id=split value=split onclick="getValue()"> </body> </html> Link to comment https://forums.phpfreaks.com/topic/66311-javascript-passing-hidden-input-feild-to-variable-writing-it-out/ Share on other sites More sharing options...
Karl33to Posted August 23, 2007 Share Posted August 23, 2007 document.write should only be used before the page has finished loading, if its for debugging you could use alert(''); or even have a debugging div and use document.getElementById("debug").innerHTML = "sometext"; Link to comment https://forums.phpfreaks.com/topic/66311-javascript-passing-hidden-input-feild-to-variable-writing-it-out/#findComment-332399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.