473,513 Members | 2,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 ?

Jan 11 '07 #1
3 1776
jn******@earthlink.net wrote:
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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 11 '07 #2

jn******@earthlink.net wrote:
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.
--
Rob

Jan 11 '07 #3
I took out the assignment to ThisPageURL and TimeZoneOffset.value and
it works fine but I don't know why in both browsers.

RobG wrote:
jn******@earthlink.net wrote:
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.
--
Rob
Jan 15 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3107
by: nick | last post by:
I have the following code: var w=window.open('popup.htm','','width=400,height=400'); w.opener = this; var img = w.document.getElementById('pic'); However, the img variable is always null in Mozilla Firefox. But it works well in IE.
9
2346
by: Ian Renfrew | last post by:
Essentially, I want to prevent the display of the Microsoft Internet Explorer or any other branding tag in the document title. One technique that I've used is to insert multiple spaces after the desired title to push the tag off of the screen. (i.e. <title>Document Title &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>) I want to write some...
2
2587
by: yawnmoth | last post by:
As I understand it, document.layers only works in Netscape 4+ (ie. it doesn't work in any version of Internet Explorer), while document.all only works in Internet Explorer 4+ (ie. it doesn't work in any version of Netscape). Is that correct? Also, what about document.getElementById? When did Internet Explorer start supporting that and...
2
9458
by: petermichaux | last post by:
Hi, I just tested all the browsers I have for support of document.documentElement.scrollLeft to determine how many pixels the window has been scrolled to the right. I'm trying to determine if I really need to go to all the trouble of feature detection for determine page scroll amount of if the old browsers are old enough now just to ignore...
4
2607
by: dr1ft3r | last post by:
Hey guys, I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an iframe's src property. Being that IE does not follow standard and considers an id, name, etc as a qualifying identifier for the document.getElementById...
5
7466
by: dmk | last post by:
Hi All, function getWindowSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+...
4
1344
by: Joe D Williams | last post by:
Hi, First I have an object element: <object id='mC' class='content2' data='index.htm' type='text/html' style=''> </object> And a link with onclick:
7
8956
by: sj071 | last post by:
I'm little more than a novice when it comes to javascript, and this particular problem has been driving me mad for the past few days... The Problem: I have a javascript file that uses document.write to send output to the browser. This javascript file contains some html code and another script tag. The execution order in Internet Explorer...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7128
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7543
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4759
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3255
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.