Document object is not set in Internet Explorer - works in Firefox

J

jnhemley

I have a script that works in Firefox but not IE6-

<script language="JavaScript" type="text/javascript">
document.Params.ThisPageURL.value=document.URL;
var x = new Date ();
document.Params.TimeZoneOffset.value =x.getTimezoneOffset();
document.Params.submit ();
</script>

The form is set this way:
<FORM ACTION="<?php echo("$Action"); ?>" METHOD="POST" NAME="Params"
<input type="hidden" NAME="ThisPageURL" value=""><input type="hidden"
Name="$ERR" value=""><input type="hidden" name ="TimeZoneOffset"
value=""><input type="hidden" Name="$U" value=""><input type="hidden"
Name="$R" value=""><input type="hidden" Name="$T" value="">


I get the following error in IE:
document.Params.ThisPageURL is null or not an object

Any idea what the problem is ?
 
M

Martin Honnen

The form is set this way:
<FORM ACTION="<?php echo("$Action"); ?>" METHOD="POST" NAME="Params"
^^
You need to close the opening form tag there with a '>' character.
 
R

RobG

I have a script that works in Firefox but not IE6-

<script language="JavaScript" type="text/javascript">
document.Params.ThisPageURL.value=document.URL;
var x = new Date ();
document.Params.TimeZoneOffset.value =x.getTimezoneOffset();
document.Params.submit ();
</script>

Your script appears to be global code that is executed before the DOM
object that it refers to is built. Either put the script after the
element's HTML, or wrap it in a function and execute it after the
element is created, say use window.onload.

[...]
I get the following error in IE:
document.Params.ThisPageURL is null or not an object

Which is commonly caused by trying to access a DOM object that doesn't
exist yet.
 
J

jnhemley

I took out the assignment to ThisPageURL and TimeZoneOffset.value and
it works fine but I don't know why in both browsers.
I have a script that works in Firefox but not IE6-

<script language="JavaScript" type="text/javascript">
document.Params.ThisPageURL.value=document.URL;
var x = new Date ();
document.Params.TimeZoneOffset.value =x.getTimezoneOffset();
document.Params.submit ();
</script>

Your script appears to be global code that is executed before the DOM
object that it refers to is built. Either put the script after the
element's HTML, or wrap it in a function and execute it after the
element is created, say use window.onload.

[...]
I get the following error in IE:
document.Params.ThisPageURL is null or not an object

Which is commonly caused by trying to access a DOM object that doesn't
exist yet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top