Entry
How can i refer the different names of input in a single function
Oct 23rd, 2002 14:47
Amit Arora, Aravinda Kumar,
Just call the function with "this"
E.g.
// Declare the function as below
function AllPurpose( objInput )
{
sName = objInput; // sName 'll have the Input's name now ...
// If you want to take action using the name ...
// you can do like this
if (objInput.name == "email)
{
// Do something ...
}
else
{
// Do something else ...
}
}
And call the function like this ....
I am just showing an example of onblur even, you can apply this to any
event.
<input type='text' name='name' onblur='AllPurpose(this);'>
<input type='text' name='email' onblur='AllPurpose(this);'>