Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old March 19th, 2004, 04:40 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
Old March 19th, 2004, 05:12 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #5 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.