|
Trouble passing a user defined variable to a form
I'm using the following script to have the user increment and decrement a number. When they are done I need the variable submitted through a form but I can't seem to attach it correctly when I try. What needs to be added so it will pass the value of X when the user hits submit?
<script type="text/javascript">
<!--//
function updateX(id,number){
var element = document.getElementById(id);
element.innerHTML = element.innerHTML/1+number;
}
//-->
</script>
</head>
<body>
<img style="cursor:pointer;border:none" src="minus.gif" onclick="updateX('x',-1)">
<span style="width:25px;text-align:center;color:red" id="x">0</span>
<img style="cursor:pointer;border:none" src="plus.gif" onclick="updateX('x',+1)">
|