JavaScript doesnt run on netscape 7.1

L

Lee

Gaurav said:
Hello,

i have some java script with in html. It runs fine on IE 6.0 but
doesnt run on netscape 7.1

Can someone tell me whats the problem ? And how can i solve it.

here is the url

http://godot.urol.uic.edu/output.html

The error message in Netscape 7.1 is that "o" is not defined
in line 127.

As soon as you use document.write() to change the contents of
the page, the entire previous page is erased, including your
javascript variables.

I didn't look at your code any more closely than to see the
problem, but you could probably fix it by accumulating all
of the HTML that you want to write in a string variable, and
then using document.write() once, to write the value of that
variable.
 
D

DU

Gaurav said:
Hello,

i have some java script with in html. It runs fine on IE 6.0 but
doesnt run on netscape 7.1

Can someone tell me whats the problem ? And how can i solve it.

here is the url

http://godot.urol.uic.edu/output.html

thank you in advance.

Gaurav

Your markup code needs to be fixed first. You should quote all your
attribute values.
http://www.htmlhelp.org/faq/html/basics.html#quotes
"By default, SGML requires that all attribute values be delimited using
either double quotation marks (...)"
http://www.w3.org/TR/html4/intro/sgmltut.html#attributes
Why attribute values should always be quoted in HTML
http://www.cs.tut.fi/~jkorpela/qattr.html
<form> needs an action attribute. type can not be number, etc... Also,
you need to define a charset:
http://www.htmlhelp.com/tools/validator/charset.html
Choose a doctype declaration (preferably strict DTD) like

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

then define the character set and finally validate your document. Once
your document is perfectly valid, it will work in all web standard
compliant browsers and your webpage script functions difficulties can be
fixed with a lot more ease.

Activating the Right Layout Mode Using the Doctype Declaration
http://www.hut.fi/u/hsivonen/doctype.html

W3C validator
http://validator.w3.org/

Why we won't help you
http://diveintomark.org/archives/2003/05/05/why_we_wont_help_you

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
J

John G Harris

"By default, SGML requires that all attribute values be delimited using
either double quotation marks (...)"

The HTML spec then goes on to say :

"In certain cases, authors may specify the value of an attribute
without any quotation marks. The attribute value may only contain
letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
periods (ASCII decimal 46), underscores (ASCII decimal 95), and
colons (ASCII decimal 58). We recommend using quotation marks even
when it is possible to eliminate them."

You should at least quote the latest issue : it's now HTML 4.01.

<snip>

John
 
L

Lasse Reichstein Nielsen

John G Harris said:
The HTML spec then goes on to say :
....

Yes? Are you disagreeing that this is a relevant link when telling
people to quote their attribute values?
You should at least quote the latest issue : it's now HTML 4.01.

It *is* the latest issue.
<URL:http://www.w3.org/TR/html4/intro/sgmltut.html#attributes>
and
<URL:http://www.w3.org/TR/html401/intro/sgmltut.html#attributes>
both refer to the exact same document. If you follow the <link
rel="contents">-link, you get to the front page of the HTML 4.01
specification.
It is also avalable as
<URL:http://www.w3.org/TR/1999/REC-html401-19991224/intro/sgmltut.html#h-3.2.2>
which is apparently the official link.

The actual HTML 4.0 specification would have been this link:
<URL:http://www.w3.org/TR/1998/REC-html40-19980424/intro/sgmltut.html#h-3.2.2>


/L
 
D

DU

John said:
The HTML spec then goes on to say :

"In certain cases, authors may specify the value of an attribute
without any quotation marks. The attribute value may only contain
letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
periods (ASCII decimal 46), underscores (ASCII decimal 95), and
colons (ASCII decimal 58). We recommend using quotation marks even
when it is possible to eliminate them."

Yes. That is why I used (...) to indicate further reading. Is there a
problem with that?
You should at least quote the latest issue : it's now HTML 4.01.

But on this precise issue, the HTML 4.01 TR does not differ at all from
HTML 4.0 TR. And the link will point to the same reference. So, what is
your point exactly?

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html
 
G

Gaurav

Lee said:
Gaurav said:

The error message in Netscape 7.1 is that "o" is not defined
in line 127.

As soon as you use document.write() to change the contents of
the page, the entire previous page is erased, including your
javascript variables.

I didn't look at your code any more closely than to see the
problem, but you could probably fix it by accumulating all
of the HTML that you want to write in a string variable, and
then using document.write() once, to write the value of that
variable.

*************************

Thank you..I tried using string variable and now it works fine in
netscape 7.1

There is one problem left though, my page keeps loading endlessly even
though it has spitted out the output.
 
L

Lee

Gaurav said:
*************************

Thank you..I tried using string variable and now it works fine in
netscape 7.1

There is one problem left though, my page keeps loading endlessly even
though it has spitted out the output.

After you document.write() the string, issue:
document.close();
So Netscape knows you're done writing.
 
J

John G Harris

Yes. That is why I used (...) to indicate further reading. Is there a
problem with that?
<snip>

If you'd said that it is wiser or better to put quotes round attribute
values I would agree with you. If you'd also said that it saves having
to remember when quotes really are needed I wouldn't have commented.

As it is, you implied that missing out the quotes is wrong, which could
confuse people.

John
 
G

Gaurav

Lee said:
Gaurav said:

After you document.write() the string, issue:
document.close();
So Netscape knows you're done writing.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Thank you . I tried document.close and now netscape 7.1 stops after
running the script.

I am facing another problem that is specific to netscape 7.1
Background color of the webpage is not coming out correctly.
http://godot.urol.uic.edu/~gaurav/out.html
If i use IE 6.0 or Netscape 6.0 it comes out fine.
 
L

Lee

Gaurav said:
I am facing another problem that is specific to netscape 7.1
Background color of the webpage is not coming out correctly.
http://godot.urol.uic.edu/~gaurav/out.html
If i use IE 6.0 or Netscape 6.0 it comes out fine.

Once the document exists, you can't set the bgColor attribute.

In the <head> section, add a style block:

<style type="text/css">
BODY {background-color:blue}
</style>

That should work for any modern browser.
 
L

Lasse Reichstein Nielsen

I am facing another problem that is specific to netscape 7.1
Background color of the webpage is not coming out correctly.
http://godot.urol.uic.edu/~gaurav/out.html

The offending line is

document.bgColor="blue";

I don't know which standard this should come from, but it's not the
W3C DOM. It doesn't work in Opera 7 either.

What you should use is:
document.body.style.backgroundColor="blue";
Still, the problem is probably that at the time you execute the
line, the body doesn't exist yet.

If you wait until later:
<body onload='document.bgColor="blue";'>
it works as you expect it to.

(other comments: the correct script start tag is
<script type="text/javascript"
The type attribute is *required* in HTML 4, while the language
attribute is deprecated.
You don't need HTML comments inside the script tag.)


/L
 
G

Gaurav

Lasse Reichstein Nielsen said:
The offending line is

document.bgColor="blue";

I don't know which standard this should come from, but it's not the
W3C DOM. It doesn't work in Opera 7 either.

What you should use is:
document.body.style.backgroundColor="blue";
Still, the problem is probably that at the time you execute the
line, the body doesn't exist yet.

If you wait until later:
<body onload='document.bgColor="blue";'>
it works as you expect it to.

(other comments: the correct script start tag is
<script type="text/javascript"
The type attribute is *required* in HTML 4, while the language
attribute is deprecated.
You don't need HTML comments inside the script tag.)


/L


did you mean
<body onload='document.body.style.backgroundColor="blue";'>
 

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,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top