473,378 Members | 1,555 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,378 software developers and data experts.

Yet another IE/W3C confusion

Don
I was recently handed responsibility for a web site that is a
combination of ASP, javascript, and some cgi-bin style programs which
generate HTML with javascript. Though I'm new to javascript, the
language isn't causing my any headaches but the difference in how code
gets processed by different browsers is enough to send me searching for
Zoloft.

One of the generated pages has this general structure:

<html>
<head>
<script type="text/javascript" src="/main.js"></script>
<script type="text/javascript" src="/file.js"></script>
<script type="text/javascript" language="JavaScript">
var url="http://www.yadayada.net";
var name="yada";
</script>
<title>Title</title>
</head>
<body onload="init();" >
<script type="text/javascript" src="/menu.js"></script>
....
</body>
</html>

main.js contains general purpose functions used within the body
init() is in file.js and sets up for code in menu.js
menu.js references functions in file.js

The javascript in menu.js was slanted heavily toward IE 4, looks like it
supports NS 4, and doesn't function properly in NS6/Mozilla. So I
reworked it to work with the W3C DOM. Running from files on my local
drive, the pages and menus displayed correctly in both IE6 and Mozilla
1.3 so I pushed them over to the test server. Loaded from there the
code works correctly in Mozilla but in IE6 it throws an error because it
can't find the init() function which is in file.js Taking init() out of
the body tag makes no difference to Mozilla which continues to display
the menu correctly. But without the init() IE shows nothing.

However, if instead of using a <script ... src=file.js> tag, I take the
code from file.js and but it in-line within a script block, IE can find
the init() function and display everything correctly.

It looks as if IE is holding of on reading the script files until after
the body has loaded. Since it hasn't read the file with the init()
function in it, it can't find it.

Has anyone else seen anything like this?

Jul 20 '05 #1
1 2719
Don wrote:
However, if instead of using a <script ... src=file.js> tag, I take the
code from file.js and but it in-line within a script block, IE can find
the init() function and display everything correctly. Has anyone else seen anything like this?


Only when somebody slipped HTML (<--//) in to the external JavaScript file.
A URL makes these things much easier to troubleshoot.

--
David Dorward http://david.us-lot.org/
Redesign in progress: http://stone.thecoreworlds.net/
Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/20...ces-ie-is-dead
Jul 20 '05 #2

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

Similar topics

1
by: Doug Farrell | last post by:
Hi all, I'm trying to do the following from within a code module: import re # text to match text = "Good morning x something /x, how are you today x something else /x"
1
by: Mathias Mamsch | last post by:
Hi, I have some confusion concerning the weakref module. I am trying to save a weak reference to a bound member function of a class instance for using it as a callback function. But I always...
38
by: Grant Edwards | last post by:
In an interview at http://acmqueue.com/modules.php?name=Content&pa=showpage&pid=273 Alan Kay said something I really liked, and I think it applies equally well to Python as well as the languages...
10
by: Kamilche | last post by:
I'm trying to pack two characters into a single byte, and the shifting in Python has me confused. Essentially, it should be possible to use a 'packed string' format in Python, where as long as...
4
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though...
0
by: i_have_control | last post by:
I'd be grateful for any input on this one: I have three web domains. The destinations of two are set to folders on the first, though that fact is transparent to the user (i.e: it does not...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
10
by: joelagnel | last post by:
hi friends, i've been having this confusion for about a year, i want to know the exact difference between text and binary files. using the fwrite function in c, i wrote 2 bytes of integers in...
1
by: Richard Lewis Haggard | last post by:
I'm having a problem with what appears to be some sort of confusion with references. I have a single solution with a dozen projects which has been working quite nicely for a while. The references...
2
by: Riaaaa | last post by:
Hello, We are doing the project in VB.Net. We had a great confusion for ASP.Net and VB.Net. Is VB.Net project performed in Microsoft Visual Studio 2005 ?? We have...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.