A
Andy
Hi
Using IE6.
I have a textbox in a form. The form is called 'form1' and the textbox is
called 'textfield1'. I have an onBlur event on the textbox to check its
contents is an integer thus: <input type="text" name="textfield1"
onBlur="checkInteger(this);">
The function checkInteger(this) is :
function checkInteger(pField)
{
var pattern=/^[0-9]*$/;
if(!(pattern.test(pField.value)) & (pField.value!=""))
{
alert(pField.name + " must must be an integer");
}
}
I want the focus to go back to the field the error was thrown in. I have
tried all sorts of methods but the only one that seems to work is directly
refencing the textfield1 object like this:
document.form1.textfield1.focus();
I would like to do something like:
var oField=pField;
document1.form1.oField.focus();
I keep getting document.form1.oField has no properties. Whats wrong?
Many thanks for looking and any help.
Andy
Using IE6.
I have a textbox in a form. The form is called 'form1' and the textbox is
called 'textfield1'. I have an onBlur event on the textbox to check its
contents is an integer thus: <input type="text" name="textfield1"
onBlur="checkInteger(this);">
The function checkInteger(this) is :
function checkInteger(pField)
{
var pattern=/^[0-9]*$/;
if(!(pattern.test(pField.value)) & (pField.value!=""))
{
alert(pField.name + " must must be an integer");
}
}
I want the focus to go back to the field the error was thrown in. I have
tried all sorts of methods but the only one that seems to work is directly
refencing the textfield1 object like this:
document.form1.textfield1.focus();
I would like to do something like:
var oField=pField;
document1.form1.oField.focus();
I keep getting document.form1.oField has no properties. Whats wrong?
Many thanks for looking and any help.
Andy