473,320 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem in IE6 but not IE4


Page part <URL:http://www.merlyn.demon.co.uk/js-index.htm#BC> works in
IE4 but not in IE6. IE6 says "invalid argument, apparently referring to
the "var Wid" line in the javascript section below.

IIRC, also, before the code is executed, the target area created by

<div ID="BarCht" style="position:relative;
width:360; height:340; background:silver; text-align:center;">

does not appear.
function BarChart3(F, Str) { var J, L, T, A, Min, Max, Sum, Bsw, Bsh
var Wid, Hgt, St = "Chart 3\n", TopM = 20, BotM = 20 // Margins
L = (A = Str.split(",")).length
Wid = Math.round(parseInt(BarCht.style.width) / L)
Suggestions? After pressing the Chart3 button, IE4 gives something
rather like the older <URL:http://www.merlyn.demon.co.uk/barchart.gif>.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 23 '05 #1
9 1382
Dr John Stockton wrote:
Page part <URL:http://www.merlyn.demon.co.uk/js-index.htm#BC>
This URL references a non-existent fragment. I'm guessing you are actually
talking about: http://www.merlyn.demon.co.uk/js-tests.htm#BC
works in IE4 but not in IE6.
Generally, this would suggest that its a Quirks Mode / Standards Mode
problem. IE6 looks at the Doctype given and uses it to guess how savvy the
author is (shame that it is such an amazingly poor metric), and if it
decides on "Smart" it turns off the emulation of a number of bugs that
appeared in earlier versions of the browser. IE4 predates this innovation.

I don't know if your Doctype triggers Standards mode - for some reason you
are using the public identifier for HTML 4.01 Transitional with the URL to
the DTD for HTML 4.01 Strict.

I suggest you use the correct Doctype Declaration for HTML 4.01 Strict:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

You could also use the correct Doctype Declaration for HTML 4.01
Transitional, but I'd suggest avoiding it (since there should be no need to
use transitional features in 2005).

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
IE6 says "invalid argument, apparently referring to
the "var Wid" line in the javascript section below.
I've never been impressed with the IE JavaScript error reporting. You might
try a browser that does a better job. Firefox for example, which complains
that "BarCht" is not defined.
IIRC, also, before the code is executed, the target area created by

<div ID="BarCht" style="position:relative;
width:360; height:340; background:silver; text-align:center;">


Your CSS is invalid. Non-zero lengths require units.

Looks like you are depending on the browser creating, for each element with
an id, a global variable of the same name containing a reference to said
element. Most don't. See
http://www.mozilla.org/docs/web-deve...ade_2.html#dom

"The following document object properties are not supported in the W3C
Document Object Model" ... "id_attribute_value"
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Nov 23 '05 #2
Dr John Stockton <jr*@merlyn.demon.co.uk> writes:
IE6 says "invalid argument, apparently referring to
the "var Wid" line in the javascript section below.

IIRC, also, before the code is executed, the target area created by

<div ID="BarCht" style="position:relative;
width:360; height:340; background:silver; text-align:center;">
This is invalid CSS. The width and height values needs a unit,
probably "px", i.e., "width:360px; height:340px".

If the page is in standards mode on IE6, then it will, correctly, ignore
erroneous declarations, so BarCht.style.width will be undefined.

The page's DOCTYPE is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/strict.dtd">
(inconsistently using Transitional description but strict dtd)
It should be sufficient to put IE6 into standards mode.
Wid = Math.round(parseInt(BarCht.style.width) / L)


I see no declaration of "BarCht" as a variable. Referring to DOM
elements by using their id or name as a global variable is not
generally supported across browsers.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Nov 23 '05 #3
JRS: In article <dl*******************@news.demon.co.uk>, dated Sun, 13
Nov 2005 00:47:22, seen in news:comp.lang.javascript, David Dorward
<do*****@yahoo.com> posted :
Dr John Stockton wrote:
Page part <URL:http://www.merlyn.demon.co.uk/js-index.htm#BC>
This URL references a non-existent fragment. I'm guessing you are actually
talking about: http://www.merlyn.demon.co.uk/js-tests.htm#BC


Apologies; you are of course right.

I suggest you use the correct Doctype Declaration for HTML 4.01 Strict:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
That does no evident harm, on that page, in IE4. Before I change the
other 150-odd pages, can you guess where, if anywhere, that might break
anything?
I've never been impressed with the IE JavaScript error reporting. You might
try a browser that does a better job. Firefox for example, which complains
that "BarCht" is not defined.
IIRC, also, before the code is executed, the target area created by

<div ID="BarCht" style="position:relative;
width:360; height:340; background:silver; text-align:center;">


Your CSS is invalid. Non-zero lengths require units.


Indeed. In correcting the others, I'd failed to notice that as a style.

Looks like you are depending on the browser creating, for each element with
an id, a global variable of the same name containing a reference to said
element. Most don't. See
http://www.mozilla.org/docs/web-deve...ade_2.html#dom

"The following document object properties are not supported in the W3C
Document Object Model" ... "id_attribute_value"


I'll look ; but meanwhile I'm supposing that using
var BarCht = document.getElementById("BarCht")
might make it work in IE6; it may be a few days before I can see.

Thanks; also to LRN.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 23 '05 #4
Dr John Stockton said the following on 11/13/2005 6:26 PM:
JRS: In article <dl*******************@news.demon.co.uk>, dated Sun, 13
Nov 2005 00:47:22, seen in news:comp.lang.javascript, David Dorward
<do*****@yahoo.com> posted :
Dr John Stockton wrote:
I suggest you use the correct Doctype Declaration for HTML 4.01 Strict:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

That does no evident harm, on that page, in IE4. Before I change the
other 150-odd pages, can you guess where, if anywhere, that might break
anything?


Anywhere where there is a difference in Quirks and Strict Mode. In IE4,
you shouldn't ever see a difference. In IE6 you will though. And in
Strict Mode IE6 is less forgiving than in Quirks Mode.

Looks like you are depending on the browser creating, for each element with
an id, a global variable of the same name containing a reference to said
element. Most don't. See
http://www.mozilla.org/docs/web-deve...ade_2.html#dom

"The following document object properties are not supported in the W3C
Document Object Model" ... "id_attribute_value"

I'll look ; but meanwhile I'm supposing that using
var BarCht = document.getElementById("BarCht")
might make it work in IE6; it may be a few days before I can see.


It won't make it work in IE6 if it doesn't work without it. It will make
it work in non-MS browsers though. Or rather, it will come closer to
working in non-MS browsers with it than it will without it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 23 '05 #5
Randy Webb wrote:
I suggest you use the correct Doctype Declaration for HTML 4.01 Strict:
That does no evident harm, on that page, in IE4. Before I change the
other 150-odd pages, can you guess where, if anywhere, that might break
anything?
Anywhere where there is a difference in Quirks and Strict Mode. In IE4,
you shouldn't ever see a difference. In IE6 you will though. And in
Strict Mode IE6 is less forgiving than in Quirks Mode.


Can you confirm that the Doctype the OP was using previously does trigger
Quirks mode then?
I'll look ; but meanwhile I'm supposing that using
var BarCht = document.getElementById("BarCht")
might make it work in IE6; it may be a few days before I can see.


It won't make it work in IE6 if it doesn't work without it.


Unless the DTD used previously was also triggering Standards mode, and that
IE turns off its creation of global variables in that mode.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Nov 23 '05 #6
David Dorward <do*****@yahoo.com> writes:
Can you confirm that the Doctype the OP was using previously does trigger
Quirks mode then?
I doubt it. It should trigger standards mode according to Microsoft.
Any DOCTYPE for HTML 4 with an URL will trigger standards mode. It
doesn't depend on the content of the URL.

<URL:http://msdn.microsoft.com/library/en-us/dnie60/html/cssenhancements.asp>
(under 'The !DOCTYPE "Switch"')
Unless the DTD used previously was also triggering Standards mode, and that
IE turns off its creation of global variables in that mode.


IE doesn't turn off global variables in standards mode, so no.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Nov 23 '05 #7
JRS: In article <dl*******************@news.demon.co.uk>, dated Sun, 13
Nov 2005 00:47:22, seen in news:comp.lang.javascript, David Dorward
<do*****@yahoo.com> posted :

Looks like you are depending on the browser creating, for each element with
an id, a global variable of the same name containing a reference to said
element. Most don't. See
http://www.mozilla.org/docs/web-deve...ade_2.html#dom


I rather dislike Web pages that crash my browser, especially when plain
text seems quite adequate for the material. I especially dislike ones
that kill the operating system. And it's particularly helpful if
something about updating can be read on an older system.

###

If dropping Transitional makes IE6 stricter than otherwise, then it
seems inappropriate to drop it until IE6 becomes more frequently
accessible to me.

###

A new <URL:http://www.merlyn.demon.co.uk/js-tests.htm#BC> was uploaded
at about 19:51 GMT today (Monday).

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 23 '05 #8
Dr John Stockton wrote:
http://www.mozilla.org/docs/web-deve...ade_2.html#dom
I rather dislike Web pages that crash my browser, especially when plain
text seems quite adequate for the material. I especially dislike ones
that kill the operating system. And it's particularly helpful if
something about updating can be read on an older system.


Its valid HTML, valid CSS, and doesn't have any JavaScript. You didn't
specify what browser you are using, but I'd blame it rather then Mozilla.
If dropping Transitional makes IE6 stricter than otherwise
It doesn't. The relationship between browser's decision between Quirks mode
and Standards mode is not directly related to your choice of Strict or
Transitional. According to <news:r7**********@hotpop.com>, any URL with
that public identifier will trigger Standards mode, so switching to Strict
won't change IEs rendering mode.
A new <URL:http://www.merlyn.demon.co.uk/js-tests.htm#BC> was uploaded
at about 19:51 GMT today (Monday).


Runs under Gecko without errors now.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Nov 23 '05 #9
JRS: In article <dl*******************@news.demon.co.uk>, dated Tue, 15
Nov 2005 07:56:11, seen in news:comp.lang.javascript, David Dorward
<do*****@yahoo.com> posted :
Dr John Stockton wrote:
http://www.mozilla.org/docs/web-deve...ade_2.html#dom


I rather dislike Web pages that crash my browser, especially when plain
text seems quite adequate for the material. I especially dislike ones
that kill the operating system. And it's particularly helpful if
something about updating can be read on an older system.


Its valid HTML, valid CSS, and doesn't have any JavaScript. You didn't
specify what browser you are using, but I'd blame it rather then Mozilla.


It was in my sig : IE4.

A new <URL:http://www.merlyn.demon.co.uk/js-tests.htm#BC> was uploaded
at about 19:51 GMT today (Monday).


Runs under Gecko without errors now.


Thanks. And it is OK under IE6. I'll move it to js-misc1.htm,
probably, when I need to create js-misc1.htm.

I now have a fair approximation to a javascript analogue clock, at
<URL:http://www.merlyn.demon.co.uk/js-anclk.htm#A> (foot of page). It's
as expected in IE4; it works in IE6, but in IE4 the square case fits
symmetrically round the round dial with (IIRC) 2px to spare, but in IE6
it extends a number of px more to right and down.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 23 '05 #10

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

Similar topics

11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
117
by: Peter Olcott | last post by:
www.halting-problem.com
18
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: =?Utf-8?B?am8uZWw=?= | last post by:
Hello All, I am developing an Input Methop (IM) for PocketPC / Windows Mobile (PPC/WM). On some devices the IM will not start. The IM appears in the IM-List but when it is selected from the...
1
by: sherifbk | last post by:
Problem description ============== - I have 4 clients and 1 server (SQL server) - 3 clients are Monitoring console 1 client is operation console - Monitoring console collects some data from...
9
by: AceKnocks | last post by:
I am working on a framework design problem in which I have to design a C++ based framework capable of solving three puzzles for now but actually it should work with a general puzzle of any kind and I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.