Click to See Complete Forum and Search --> : help with error
jrthor2
07-22-2003, 08:29 AM
Can anyone please tell me how to fix this error I get when loading my page:
Line 148
Char 10
Error 'document.all.sposorAdDiv.style' is null or not an object
Code 0
url: http://www.zluth.org
Attached is my page's code.
Thanks
Khalid Ali
07-22-2003, 09:12 AM
Chance are that in the line
document.all.sposorAdDiv
sposorAdDiv is not spelled correctly or it does not exist in the document..
You have to make sure the spellings are correct.
jrthor2
07-22-2003, 09:23 AM
If you would have looked at my code, this is a style property, it is there and spelled correctly throughout the entire page.
Gollum
07-22-2003, 09:38 AM
But there is no HTMLElement of that name, and that is what is causing the error.
Also, since the word 'sponsorAdDiv' isn't used anywhere else in the page - unless it is created dynamically, I can't see how it can have the effect you were hoping.
Khalid Ali
07-22-2003, 09:42 AM
Originally posted by jrthor2
If you would have looked at my code,
In most of the cases I don't need to,
read my first post...I said make sure spnsorAdDiv does exist in the document..
Now take a look at this line of code in css section of your page
sponsorAdDiv {position:absolute; height:1; width:1; top:0; left:0;}
you might think you have declared this id,but its not..
to make it corrrectly declared as an id you need to put a # before the name
#sponsorAdDiv {position:absolute; height:1; width:1; top:0; left:0;}
use the above and if no other error it will work.
jrthor2
07-22-2003, 09:43 AM
I'm not a Javascript person, so not quite sure what you mean by no HTMLElement. at the very bottom of the page, there is a div that calls this style.
the code works as it should, it pops up a window on the given date, but I noticed that the page had errors on it and wanted to fix them so people who have script debugging on don't get the annoying popup or yellow script error icon in their browser.
jrthor2
07-22-2003, 09:45 AM
I put in the # in my style code, but I still get the same error. Is it because the div code that calls this funtion is only used on a certain date?
jrthor2
07-22-2003, 09:49 AM
I got it fixed, it was because the code was only called if the date equaled a certain date. So I modified the code at the very bottom to look like this:
<!--Popup Ad box -->
<% if kaos_date("%E, %N %d%s, %Y", Now) = "Saturday, June 7th, 2003" then %>
<div id="sponsorAdDiv" style="visibility:hidden">
<table width="450" height="350" bgcolor="#330099"><tr><td>
<table width="445" height="345" bgcolor="#d7d7ff"><tr><td align="center" valign="middle">
<!--*****EDIT THIS MESSAGE*****-->
<p>
<img src="/committees/images/buzz%20jones%20400.jpg"><p><b>June 7 Buzz Jones Concert Postponed due to inclement weather. Please check back for new date and time.<br><br>Thank You!</b>
</p>
<p>(This announcement will close shortly</p>
<!--*****EDIT THE ABOVE MESSAGE*****-->
</td></tr></table></td></tr></table>
<%
Else%>
<div id="sponsorAdDiv" style="visibility:hidden">
<%
End if %>
<!--End Popup Ad code -->