Jump to content

Value


user4fun

Recommended Posts

<script type="text/javascript">	 var params ="";   var objValue = document.getElementById("MyNumber");	var objUser = document.getElementById("username_chk");	var objPass = document.getElementById("password_chk");	 var params = "?choice=" + objValue + "&username_chk=" + objUser + "&password_chk=" + objPass;document.write(params);document.write("<br />");</script>password <input type="hidden" id="password_chk" value ="5753020">user <input type="hidden" id="username_chk" value ="afifiman1">ans <input type="hidden" id="MyNumber" value ="43467">

var params always end up being ?choice=null&username_chk=null&password_chk=nullwhy is that?

Link to comment
Share on other sites

It looks like you're trying to access the values of the elements before they exist on the page.Try this:

password <input type="hidden" id="password_chk" value="5753020">user <input type="hidden" id="username_chk" value="afifiman1">ans <input type="hidden" id="MyNumber" value="43467"><script type="text/javascript">var params = "";var objValue = document.getElementById("MyNumber");var objUser = document.getElementById("username_chk");var objPass = document.getElementById("password_chk");var params = "?choice=" + objValue.value + "&username_chk=" + objUser.value + "&password_chk=" + objPass.value;document.write(params);document.write("<br />");</script>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...