I need to know how to pass variables because I want to use the same
function to varify multiple data imput boxes.
Please tell me what's wrong with this code.
<head>
<script language="JavaS cript">
function myFunction(this ){
entry=document. Forms[0].this.value;
if (document.Forms[0].this.value=="" ){
document.Forms[0].this.focus();
}
else {
// Do something with "entry" here
}
if (this = "inputBox2" ) {
document.Forms[0].total.value = document.Forms[0].inputBox1.valu e +
document.Forms[0].inputBox2.valu e;
}
}
</script>
</head>
<body>
<form>
<input type="text" name="inputBox1 " onBlur="myFunct ion(this)">
<input type="text" name="inputBox2 " onBlur="myFunct ion(this)">
<input type="text" name="total">
</form>
</body>
function to varify multiple data imput boxes.
Please tell me what's wrong with this code.
<head>
<script language="JavaS cript">
function myFunction(this ){
entry=document. Forms[0].this.value;
if (document.Forms[0].this.value=="" ){
document.Forms[0].this.focus();
}
else {
// Do something with "entry" here
}
if (this = "inputBox2" ) {
document.Forms[0].total.value = document.Forms[0].inputBox1.valu e +
document.Forms[0].inputBox2.valu e;
}
}
</script>
</head>
<body>
<form>
<input type="text" name="inputBox1 " onBlur="myFunct ion(this)">
<input type="text" name="inputBox2 " onBlur="myFunct ion(this)">
<input type="text" name="total">
</form>
</body>
Comment