Jump to content

Null Error problem


khenry

Recommended Posts

I am "playing" with a website at work for a non-profit org. The website is pretty basic but I cannot get over this...Line: 17Char: 3Error: 'null' is null or not an objectCode:0URL: file///F:/Website/Final/donations.htmlThis is the first part of the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><link rel="shortcut icon"href="favicon.ico" /><title>Northeast Iowa Community Action Corporation</title><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta name="description" content="NEICAC - To meet the primary needs of people and create opportunities for basic self-sufficiency through community partnership, education and the provision of services." /><meta name="keywords" content="NEICAC, Iowa, CACFP, Head Start, Early Head Start, Family Planning, Northeast Regional Transit, Energy Assistance, Weatherization, Housing, Family Development Self Sufficiency (FaDSS)" /><link rel="StyleSheet" href="menu.css" type="text/css" /><script language="javascript" src="menu.js" type="text/javascript"></script><style type="text/css">	body {	  background-color: #F6F7FA;	}	span.c1 {color: #990033; font-family: georgia bold italic}	span.c2 {color: #336699; font-family: arial}	span.c3 {font-family: arial; font-size: 160%}	span.c4 {font-family: arial; font-size: 120%}	span.c5 {font-family: arial; font-size: 100%}	span.c6 {color: #336699; font-family: arial; font-size: 160%}	span.c7 {color: #990033; font-family: arial; font-size: 100%}	span.c8 {color: #336699; font-family: georgia bold; font-size: 200%}	span.c9 {font-family: arial; font-size: 120%}	span.c10 {color: #990033; font-family: arial; font-size: 160%}	</style>		</head>

Can anyone see what is causing this error? It's driving me crazy!Thanks in advance Karen

Link to comment
Share on other sites

Can you show us what's in menu.js? This is a Javascript error.
Here it is
function expand(s){  var td = s;  var d = td.getElementsByTagName("div").item(0);  td.className = "menuHover";  d.className = "menuHover";}function collapse(s){  var td = s;  var d = td.getElementsByTagName("div").item(0);  td.className = "menuNormal";  d.className = "menuNormal";}

Link to comment
Share on other sites

I think this is what you mean:var d = td.getElementsByTagName("div");d[0].className = "menuHover";(I wrote it as two statements for clarity.)Otherwise, you're saying that your collection of divs has a method called item and you're passing that method an argument of 0. This is hypothetically possible, but not, I think, your intent. (DOM collection objects are goofy enough without changing the prototype, if it even can be done.)Make the appropriate change in both functions, of course.

Link to comment
Share on other sites

Along with the menu.js code, I have a menu.css code of

BODY{font-family: verdana, tahoma, arial, sans-serif;font-size: 10pt;margin: 5px;margin-left: 2px;margin-right: 2px;padding: 0px;}P{padding-top: 10px;margin: 0px;}H1{font-size: 12pt;font-weight: bold;padding-top: 15px;margin: 0px;}table.navbar{font-size: 8pt;margin: 0px;padding: 0px; border: 0px;font-weight: bold;}table.menu{font-size: 8pt;margin: 0px;padding: 0px;font-weight: bold;}td.menuNormal{padding: 0px;color: white;font-weight: bold;vertical-align: top;background-color: #336699;}td.menuHover{padding: 0px;color: red;font-weight: bold;vertical-align: top;/*remove the following line for drop-down menu with images*/background-color: #336699;}div.menuNormal{display: none;position: static;}div.menuHover{border: 1px solid #336699;background-color: #336699;display: inline;position: absolute;}a.menuitem:link{text-decoration: none;color: white;background-color: #336699;display: block;}a.menuitem:visited{text-decoration: none;color: white;background-color: #336699;display: block;}a.menuitem:hover{text-decoration: none;color: red;background-color: #336699;display: block;}a.menuitem:active{text-decoration: none;color: black;background-color: #336699;display: block;}

Here is a page from the website

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><link rel="shortcut icon"href="favicon.ico" /><title>Northeast Iowa Community Action Corporation</title><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta name="description" content="NEICAC - To meet the primary needs of people and create opportunities for basic self-sufficiency through community partnership, education and the provision of services." /><meta name="keywords" content="NEICAC, Iowa, CACFP, Head Start, Early Head Start, Family Planning, Northeast Regional Transit, Energy Assistance, Weatherization, Housing, Family Development Self Sufficiency (FaDSS)" /><link rel="StyleSheet" href="menu.css" type="text/css" /><script language="javascript" src="menu.js" type="text/javascript"></script><style type="text/css">	body {	  background-color: #F6F7FA;	}	span.c1 {color: #990033; font-family: georgia bold italic}	span.c2 {color: #336699; font-family: arial}	span.c3 {font-family: arial; font-size: 160%}	span.c4 {font-family: arial; font-size: 120%}	span.c5 {font-family: arial; font-size: 100%}	span.c6 {color: #336699; font-family: arial; font-size: 160%}	span.c7 {color: #990033; font-family: arial; font-size: 100%}	span.c8 {color: #336699; font-family: georgia bold; font-size: 200%}	span.c9 {font-family: arial; font-size: 120%}	span.c10 {color: #990033; font-family: arial; font-size: 160%}	</style>		</head>

Sorry, it is quite lengthy

Link to comment
Share on other sites

Strange...Let's try this again

<body><table width="100%" border="0" cellspacing="0" cellpadding="2"> 	<tr valign="top">     <td colspan="2" rowspan="2" align="left"><img src="images/Logo.jpg" width="201" height="115" border="0" 	alt="Northeast Iowa Community Action Corporation"></td>	<td align="center"><span class="c1"><font size="3"><strong>Northeast Iowa Community 	Action Corporation<br />	305 Montgomery St<br />	PO Box 487<br />	Decorah, IA 52101<br /></strong></font></span></td></tr><tr><td align="center"><span class="c1"><font size="3"><strong>Serving Allamakee, Bremer, Chickasaw, Clayton, Fayette, Howard and Winneshiek Counties<br />in Northeast Iowa<br /></strong></font></span></td>      </tr></table><!-- MAIN MENU START -->	<table class="navbar" width="100%" border="0" align="right" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">    <tr><td colspan="11" bgcolor="#990033"></td></tr>	<tr><td colspan="11" bgcolor="#336699"></td></tr><tr align="left" valign="top">      	<!-- Menu neicac START -->     	<td class="menuNormal" width="8"><p><a href="neicac.html" class="menuitem"> Home</a></p></td>	<!-- Menu neicac END -->	<!-- Menu Company Start -->	<td class="menuNormal" width="65" onmouseover="expand(this);" onmouseout="collapse(this);">        <p>Company</p>        <div class="menuNormal">          <table class="menu" width="110">            <tr>	<!-- Submenu History Start -->         		<td class="menuNormal" width="70"><a href="history.html" class="menuitem">History</a></td></tr>        <!-- Submenu History END -->	<!-- Submenu Code of Ethics Start -->		<td class="menuNormal" width="95"><a href="code.html" class="menuitem">Code of Ethics</a></td></tr>	<!-- Submenu Code of Ethics End -->	<!-- Submenu FAQs Start -->		<tr><td class="menuNormal" width="70"><a href="faqs.html" class="menuitem">FAQs</a></td></tr>        <!-- Submenu FAQs END -->	<!-- Submenu Employment Start -->		<tr><td class="menuNormal" width="70"><a href="employment.html" class="menuitem">Employment</a></td></tr>	<!-- Submenu Employment END -->	<!-- Submenu Contact Start -->		<tr><td class="menuNormal" width="70"><a href="contact.html" class="menuitem">Contact Us<br />Branch Locations</a></td></tr>         <!-- Submenu Contact END -->		        </table>        </div>      </td>      <!-- Menu Company END -->      <!-- Menu Program START -->      <td class="menuNormal" width="70" onmouseover="expand(this);" onmouseout="collapse(this);">        <p>Programs</p>        <div class="menuNormal">          <table class="menu" width="110">            	<!-- Submenu Education Start -->		<tr><td class="menuNormal" width="110"><a href="education.html" class="menuitem">Education</a></td></tr>        <!-- Submenu Education End -->	<!-- Submenu Home Energy Start -->              <tr><td class="menuNormal" width="110"><a href="energy.html" class="menuitem">Home Energy Assistance</a></td></tr>        <!-- Submenu Home Energy End -->	<!-- Submenu Home Weatherization Start -->                <tr><td class="menuNormal" width="110"><a href="weatherization.html" class="menuitem">Home Weatherization</a></td></tr>        <!-- Submenu Home Weatherization End -->		<!-- Submenu Family/Individual Services Start -->                <tr><td class="menuNormal" width="110"><a href="familyservices.html" class="menuitem">Family Services</a></td></tr>        <!-- Submenu Family/Individual Services End -->	<!-- Submenu FaDSS Start -->                <tr><td class="menuNormal" width="110"><a href="fadss.html" class="menuitem">FaDSS</a></td></tr>        <!-- Submenu FaDSS End -->	<!-- Submenu Food Start -->              <tr><td class="menuNormal" width="110"><a href="food.html" class="menuitem">Food</a></td></tr>        <!-- Submenu Food End -->	<!-- Submenu Food Banks Start -->		<tr><td class="menuNormal" width="110"><a href="foodbanks.html" class="menuitem">Food Banks</a></td></tr>        <!-- Submenu Food Banks End -->	<!-- Submenu Health Start -->              <tr><td class="menuNormal" width="110"><a href="health.html" class="menuitem">Health Programs</a></td></tr>        <!-- Submenu Health End -->	<!-- Submenu Housing Start -->              <tr><td class="menuNormal" width="110"><a href="housing.html" class="menuitem">Housing</a></td></tr>        <!-- Submenu Housing End -->	<!-- Submenu Transportation Start -->                <tr><td class="menuNormal" width="110"><a href="transport.html" class="menuitem">Transportation</a></td></tr>        <!-- Submenu Transportation End -->	<!-- Submenu Fayette County General Relief Start -->		<tr><td class="menuNormal" width="110"><a href="facogeneralrelief.html" class="menuitem">Fayette County<br />General Relief</a></td></tr>        <!-- Submenu Fayette County General Relief End -->	<!-- Submenu Winneshiek County General Relief Start -->		<tr><td class="menuNormal" width="110"><a href="wicogeneralrelief.html" class="menuitem">Winneshiek County<br />General Relief</a></td></tr>        <!-- Submenu Winneshiek County General Relief End -->        </table>        </div>      	</td>	<!-- Menu Programs END -->			<!-- Menu Board START -->      		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="board.html" class="menuitem">Board Members</a></p></td>	<!-- Menu Board END -->	      	<!-- Menu Staff START -->      		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="staff.html" class="menuitem">Staff Directory</a></p></td>	<!-- Menu Staff END -->	      	<!-- Menu Donations START -->      		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="donations.html" class="menuitem">Donations</a></p></td>	<!-- Menu Donations END -->	<!-- Menu Links START -->      		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">        	<p><a href="links.html" class="menuitem">Links</a></p></td>        <!-- Menu Links END -->	<!-- Menu Get Involved START -->      		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">        	<p><a href="getinvolved.html" class="menuitem">Get Involved</a></p></td>        <!-- Menu Links END -->	<!-- Menu Guidelines START -->		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="pov.html" class="menuitem">Poverty Guidelines</a></p></td>	<!-- Menu Guidelines END -->	<!-- Menu Messages START -->     		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="messages.html" class="menuitem">Messages</a></p></td>     	<!-- Menu Messages END -->	<!-- Menu Form 990 START -->		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="form990.html" class="menuitem">Form 990</a></p></td> 	<!-- Menu Form 990 END -->    </tr><tr><td colspan="11" bgcolor="#336699"></td></tr><tr><td colspan="11" bgcolor="#990033"></td></tr>  <!-- MAIN MENU END -->  </table><br /><br /><br /><table border="0" width="97%" cellspacing="0" cellpadding="0" align="center"><tr><td><span class="c8"><strong>Make a Donation - Change a Life</strong></span><p>	<span class="c5">Northeast Iowa Community Action Corporation (NEICAC) is a 501(c)3 private 	non-profit operating in NE Iowa.  Chartiable donations from individuals, businesses, school⁄church groups, 	made to NEICAC are always needed and may have a tax benefit to the donor.  	<p>Individuals and families in your community struggle every day to provide basic needs such as food, shelter and utilities.	Your contribution to NEICAC can make the difference to provide a hand-up to self-sufficiency.</span>	<p><span class="c2"><strong>How You Can Make a Donation</strong></span>		<p><span class="c5">100% of all donations go directly to income-eligible recipients.  NEICAC retains	no donations for administrative costs.  If you would like to make a donation by check or money order, download NEICAC's	donation form in <a href="donationword.doc" target="display_blank">Word Document</a> or 	<a href="donationpdf.pdf" target="display_blank">Adobe PDF</a>.</span>	<p><span class="c2"><strong>Energy Assistance Programs</strong></span>	<p><span class="c5">Each year, low income families in our seven county area struggle to pay their energy bills.  As the cost	of energy rises, the need for emergency assistance also rises.  You can help your neighbor through a crisis by making 	a one time or monthly donation to Aquila, Inc., Alliant Energy or MidAmerican Energy.  The application process is simple.  Just 	click on the appropriate link below and complete the application process.  Your donation will stay within your area to help your 	friend, family member or neighbor in need.	<p><a href="http://www.aquila.com/community/initiatives/assistance/" target="display_blank">Aquila, Inc</a><br>	<a href="http://www.alliantenergy.com/docs/groups/public/documents/pub/p014664.hcsp" target="display_blank">Alliant Energy</a><br>	<a href="http://www.midamericanenergy.com/html/service9.asp" target="display_blank">MidAmerican Energy</a>	<p><span class="c2"><strong>Estate Planning</strong></span>	<p><span class="c5">NEICAC relies on continual donations and grants to	provide our clients with assistance in their time of need.  Individuals and families in your community struggle every day to provide basic needs such as food, shelter and utilities.	Your contribution to NEICAC can make the difference to provide a hand-up to self-sufficiency.</span>	<p><span class="c2"><strong>United Way</strong></span><p><br><a href="http://www.adobe.com/products/acrobat/readstep2.html"><img src="images/get_adobe_reader.gif" width="112" height="33" border="0"></a><br>	<span class="c5">Click above to download Acrobat Reader</span>	</td></tr></table><br /><br /><br /><!--Begin footer--><div align="center"><br /><font size="-2">	<a href="neicac.html">Home</a>	<a href="mailto:khenry@neicac.org">Contact Webmaster</a></font><br /><em>©2007 Northeast Iowa Communty Action Corporation</em></div><!--End footer--></body></html>

Maybe it was too long the first time.

Link to comment
Share on other sites

Look at these lines:

<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);"><p><a href="staff.html" class="menuitem">Staff Directory</a></p></td>

There aren't any elements with a tag name "div". So you're going to get null with getElementsByTagName("div")getElementsByTagName("p") would work in this case

Link to comment
Share on other sites

So if I understand you correctly, what I have after my "programs" menu is incorrect because I don't have ... <div class="menuNormal">? If I did this...

<!-- Menu Staff START --><div class="menuNormal">      		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="staff.html" class="menuitem">Staff Directory</a></p></td>	<!-- Menu Staff END --></div>

Otherwise, I am to the point where my brain hurts and I can't think anymore. where do I put that line? In the menu.js code in addition to the line I have?

Link to comment
Share on other sites

Just one question.Do you know what this is doing?

function expand(s){var td = s;var d = td.getElementsByTagName("div").item(0);td.className = "menuHover";d.className = "menuHover";}

Link to comment
Share on other sites

There are no <div> elements inside your <td> elements.
Actually, the first few <td> elements that call that function do have internal divs.But the fact that some do and some don't makes the document more confused, not less.
Link to comment
Share on other sites

So to solve my errors, I need to add the <div> to my <td> like...

<!-- Menu Staff START --><div class="menuNormal">      		<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);">		<p><a href="staff.html" class="menuitem">Staff Directory</a></p></td><!-- Menu Staff END --></div>

Correct?I was truly hoping I could figure this error out on my own. But I am not so pridefull that I can't ask for help before I completely beat my head in.

Link to comment
Share on other sites

  • 1 month later...

Sorry, I haven't had a chance to get back to my error problems. I have tried a few things and still can't get it to work correctly. Can either of you give me an example with my code? That might help me.ThanksKaren

Link to comment
Share on other sites

Just put a <div> inside your <td> elements, like this:

<td class="menuNormal" width="8" onmouseover="expand(this);" onmouseout="collapse(this);"><div><a href="staff.html" class="menuitem">Staff Directory</a></div></td>
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...