Assign javascript value to html input hidden field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Hidden

Description

Assign javascript value to html input hidden field

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <form action="javascript.jsp"> 
         <input type="hidden" id="test0"> 
         <input type="hidden" id="test1"> 
         <script type="text/javascript">
       var i = 11;
       var j = 12;/*from  w  w  w .j ava 2 s .  com*/
       window.onload = function()
       {
           document.getElementById("test0").value = i;
           document.getElementById("test1").value = j;
       };
   
         </script> 
         <input type="image" src="http://www.java2s.com/style/download.png"> 
      </form>  
   </body>
</html>

Related Tutorials