Storing the last value using a Hidden object. : Form HTML : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » Form HTML »

 

Storing the last value using a Hidden object.




<html>
<head>
<title>Hidden Test</title>
<script language="JavaScript">
     function postData(value) {
          document.form1.holder2.value = document.form1.holder.value
          document.form1.holder.value = value
     }
   
     function resetValue() {
          var len = document.form1.itemList.length
          for (var i=0; i<len; i++) {
               if (document.form1.itemList[i].value == document.form1.holder2.value) {
                    document.form1.itemList[i].checked = "1"
                    break 
               }
          }
     }
   
</script>
</head>
   
<body>
<form name="form1" method="POST">
<p>
<input type=radio name="itemList" value="A" onClick="postData(this.value)">A
</p>
<p>
<input type=radio name="itemList" value="B" onClick="postData(this.value)">B
</p>
<p>
<input type=radio name="itemList" value="C" onClick="postData(this.value)">C
</p>
<p>
<input type=radio name="itemList" value="D" onClick="postData(this.value)">D</p>
<p><input type=radio name="itemList" value="E" onClick="postData(this.value)">E</p>
<p><input type=button name="UndoLast" value="Undo Last" onClick="resetValue()"></p>
  
<INPUT TYPE="hidden" NAME="holder" value="">
<INPUT TYPE="hidden" NAME="holder2" value="">
</form>
</body>
</html>
           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» Form HTML