for example if i want to get the value of an input box:
var x = document.theform.variable.value
where variable is an input field in the form
![]() | It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!) |

|
|
|
|
<form name="myform" action="#" method="post">
<input type="text" name="myinput">
<input type="button" onclick="show()" value="Show Input Value">
</form>
function show()
{
var accept = document.myform.myinput.value
alert ('Did you key in '+accept +' right?');
}

rangana wrote:The easiest way is to name your input field.For example, you have this in your page:
- Code: Select all
<form name="myform" action="#" method="post">
<input type="text" name="myinput">
<input type="button" onclick="show()" value="Show Input Value">
</form>
If you want to get the value of the input box, it is as easy as:
- Code: Select all
function show()
{
var accept = document.myform.myinput.value
alert ('Did you key in '+accept +' right?');
}
Hope made sense

rangana wrote:No, not that easy to explain. Maybe this link would help:
http://javascript.internet.com/games/ja ... -oppo.html
http://javascript.internet.com/games/ch ... -v1.0.html
Users browsing this forum: No registered users and 6 guests