Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2004, 01:43 AM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Still DHTML troubles in Netscape 7.1

Greetings, and thank you to Imar for helping me with the previous post,

I am still going out of my mind to get my DHTML to function properly in a Netscape browser.

I cannot get HTML to replace the text "Loading...(Appologies: Netscape users will wait a very long time, indeed.)", which I present here as a self-explanation for my frustration.



As a test for my browser, I wrote:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>

<div id="NavBarDiv">Old text.</div>

<script language="JavaScript" type="text/javascript">
    document.getElementById('NavBarDiv').innerHTML="He llo.";
</script>

<p>In this case, "Hello." replaces "Old text."!</p>

</body>
</html>


Successfully, "Hello" replaces "Old text".


However, innerHTML does not execute in the following block:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>

    <div ID="NavBarDiv" style="position: relative; left: 10px; top: 0 px;">
    Loading...(Appologies: Netscape users will wait a very long time, indeed.)
    </div>

    <script language="JavaScript" type="text/javascript">
        document.getElementByID('NavBarDiv').innerHTML = "Hello hello hello.";
    </script>
</body>
</html>


Admittedly, I am using Netscape 7.1, and I should walk before running, but I am also having trouble downloading Netscape 6.2,... and shouldn't this work?

Thank you,
Daniel Hutchins
Woodbridge, CA
http://www.finehomemadesoap.com
__________________
Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
 
Old March 19th, 2004, 04:40 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Daniel,

This one is pretty tricky and hard to spot. <s>IMO, it should not have worked in IE either, and instead you should have gotten an error message. </s>JavaScript is case-sensitive, so getElementById is different from getElementByID. Your second page uses ID with two capitals which<s>, unfortunately, works in IE, but not in Netscape.</s> doesn't work.

Also, AFAIK, innerHTML is not part of the official DOM recommendation, although most browsers seem to support it.....

Personally, I don't think Netscape 7 is "running" when Netscape 6 is walking. Netscape 7 just has better support for modern standards.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 19th, 2004, 05:07 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

'getElementByID' certainly doesn't work on my IE browser.
I believe innerHTML was added to Mozilla DOM by popular demand:)

--

Joe
 
Old March 19th, 2004, 05:12 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Whoops. I have no idea why I brought IE in. It doesn't work in IE either, and the OP didn't even mention it.

I think that "to function properly in a Netscape browser" made me think the the OP meant that it worked in IE. I also think I need more coffee.... ;)

Modified my initial post to correct this error.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 20th, 2004, 02:26 PM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Imar and Joe,

I have fixed the Uppercase ID to Id, and it all works. I had two of them and didn't realize it. That was fun, and one of them still had JScript. That was still a little interesting as well. Anyway, these are fixed, and I am focusing on the next challenges.

thank you again, Daniel Hutchins

Thank you,
Daniel Hutchins
Woodbridge, CA
http://www.finehomemadesoap.com




Similar Threads
Thread Thread Starter Forum Replies Last Post
DHTML Menu. rupen HTML Code Clinic 5 July 20th, 2005 05:01 AM
Can you use XSLT with DHTML? bekim XSLT 4 June 9th, 2004 11:15 AM
Do people really use DHTML? bekim Javascript 4 June 8th, 2004 08:35 PM
Where's That DHTML forum? Ben Horne Forum and Wrox.com Feedback 2 March 4th, 2004 03:06 PM
redirect netscape 4.7 to netscape 7.1 trangd Beginning PHP 10 January 15th, 2004 04:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.