•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 403,515 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,922 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 598 | Replies: 2 | Solved
![]() |
•
•
Join Date: Aug 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hello,
I have the following script that used to work with FF2. Now I get under FF3:
TypeError: document.getElementByID('content') is null
SCRIPT:
EXPLANATION:
The code created should look like this:
<p align="center"><img src="http://www.spc.noaa.gov/exper/soundings/08070112_OBS/OAX.gif"></p>
is displayed correctly (alert) but it ends up issuing the error message above (in red font).
Could anyone tell me what is wrong here? I can't find the problem.
OBSERVATION:
the part where it reads 080701 changes daily(obvious). But if in a test no results are shown and no message is issued, the try to change 12OBS to 00OBS.
The result should be a very "weird" looking meteorological stuff.
Thanks for any help
I have the following script that used to work with FF2. Now I get under FF3:
TypeError: document.getElementByID('content') is null
SCRIPT:
javascript Syntax (Toggle Plain Text)
function Sounding(){ var yr = "08"; var myArray = new Array(); myArray[0] = new Date() ; var mes = (myArray[0].getMonth() ); if (mes.length = 2) { mes = mes +1; mes = "0"+mes; } var day = (myArray[0].getDate() ); if (day.length = 1) { day = "0" + day; } var align= '<p align="center">'; var img = '<img src="'; var http = 'http://www.spc.noaa.gov/exper/soundings'; var slash = '\/'; var obs = '12_OBS/OAX.gif">'; var theString=align+img+http+slash+yr+mes+day+obs+"</p>"; alert(theString); document.getElementById('content').innerHTML=theString; } window.onload=Sounding;
EXPLANATION:
The code created should look like this:
<p align="center"><img src="http://www.spc.noaa.gov/exper/soundings/08070112_OBS/OAX.gif"></p>
is displayed correctly (alert) but it ends up issuing the error message above (in red font).
Could anyone tell me what is wrong here? I can't find the problem.
OBSERVATION:
the part where it reads 080701 changes daily(obvious). But if in a test no results are shown and no message is issued, the try to change 12OBS to 00OBS.
The result should be a very "weird" looking meteorological stuff.
Thanks for any help
•
•
Join Date: Apr 2005
Location: New York state
Posts: 458
Reputation:
Rep Power: 5
Solved Threads: 68
Well the error is generated when you try to get an element that doesn't exist so the simple question is, does the element with the ID "content" exist on the page before you make that call?
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
•
•
Join Date: Aug 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
ShawnCplus,
Thank you or your quick reply.
Now, <div id=content"></div> WAS indeed missing and I missed this probably because of the many other changes I did in that page.
Now, this is not part of the problem but it is interesting to notice that if I call the page from within Dreamweaver with file>Preview in Browser, IE7 brings the page correctly.
Using FF3, the script is not executed for some reason (it was under FF2). I get no alert message and the graph doesn't show up.
I have to load the page into the web server and then both browsers work fine.
Anyway, that was a stupid mistake of mine and thanks for placing the correct question to me in your reply. That was great.
Thank you again
Have a nice 4th of July
Thank you or your quick reply.
Now, <div id=content"></div> WAS indeed missing and I missed this probably because of the many other changes I did in that page.
Now, this is not part of the problem but it is interesting to notice that if I call the page from within Dreamweaver with file>Preview in Browser, IE7 brings the page correctly.
Using FF3, the script is not executed for some reason (it was under FF2). I get no alert message and the graph doesn't show up.
I have to load the page into the web server and then both browsers work fine.
Anyway, that was a stupid mistake of mine and thanks for placing the correct question to me in your reply. That was great.
Thank you again
Have a nice 4th of July
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
age amd avatar blue gene business chips database development dos economy energy enterprise environment hardware ibm ibm. news intel ibm it linux medicine memory microsoft news office open source openoffice pc ps3 recession red hat remote working russia security sex sun supercomputer supercomputing technology trends ubuntu working x86
- Previous Thread: Text not scrolling to last message
- Next Thread: Maintain Div Postion on Refresh


Linear Mode