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="textfield 1"
onBlur="checkIn teger(this);">
The function checkInteger(th is) is :
function checkInteger(pF ield)
{
var pattern=/^[0-9]*$/;
if(!(pattern.te st(pField.value )) & (pField.value!= ""))
{
alert(pField.na me + " 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.focu s();
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="textfield 1"
onBlur="checkIn teger(this);">
The function checkInteger(th is) is :
function checkInteger(pF ield)
{
var pattern=/^[0-9]*$/;
if(!(pattern.te st(pField.value )) & (pField.value!= ""))
{
alert(pField.na me + " 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.focu s();
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
Comment