PDA

View Full Version : IE vs FF



Hans van de Laar
13-Jan-2007, 03:53 PM
I'm trying to change the action property of a form through Java Script
, in this case the login page. After a successful login I want to
redirect the user to an other page. Below is some code part I'm using.

{
var oForm = document.getElementById("frmUserLogin");
...
oForm.action="somepage.asp";
oForm.submit();
}

I notice this is working for IE but not for FF. Firebug debugger is
indicating that oForm has no properties. If fact: if I insert
alert(oForm) I get [object] as a result in IE and [null] in FF. What is
the best way to get this working for both browsers.
--
Regards,

Hans van de Laar
Micros b.v.
The Netherlands
www.micros.nl

Anders Ohrt
14-Jan-2007, 06:01 AM
> var oForm = document.getElementById("frmUserLogin");
>
> I notice this is working for IE but not for FF. Firebug debugger is
> indicating that oForm has no properties. If fact: if I insert
> alert(oForm) I get [object] as a result in IE and [null] in FF. What is
> the best way to get this working for both browsers.

You probably have an object with name="frmUserLogin", but not
id="frmUserLogin". IE "helps" you by assigning that object the same id as
the name, while FF does not.

// Anders

Hans van de Laar
14-Jan-2007, 04:31 PM
Anders Vhrt wrote:

>
> > var oForm = document.getElementById("frmUserLogin");
> >
> > I notice this is working for IE but not for FF. Firebug debugger is
> > indicating that oForm has no properties. If fact: if I insert
> > alert(oForm) I get [object] as a result in IE and [null] in FF.
> > What is the best way to get this working for both browsers.
>
> You probably have an object with name="frmUserLogin", but not
> id="frmUserLogin". IE "helps" you by assigning that object the same
> id as the name, while FF does not.
>
> // Anders

Hi Anders,

You got me with that one. Thanks.

--
Regards,

Hans van de Laar
Micros b.v.
The Netherlands
www.micros.nl