PDA

View Full Version : Still having problems with preloading


scatteredbomb
03-18-2005, 06:49 PM
Hey forumers. I've posted this question before, i need to preload some images that i'll be using for a mouse over. Here's the code i've got so far

<script type="text/javascript">
<!--
if (document.images)
img1=new Image();
img1.src="images/right_cal.gif";
img2=new Image();
img2.src="images/right_news.gif";
img3=new Image();
img3.src="images/right_dir.gif";
img4=new Image();
img4.src="images/right_links.gif";
img5=new Image();
img5.src="images/right_mp.gif";
img6=new Image();
img6.src="images/right_forum.gif";
img7=new Image();
img7.src="images/right_shared.gif";
}
//-->
</script>

And this is the table thats using the the images

<table width="136" border="0" cellspacing="0" cellpadding="1" bgcolor="#669900">

<!--<tr>
<td class="bgcolormainNavOn" colspan="3" bgcolor="#cc3300"><img src="index/box.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>-->

<tr bgcolor="#cc3300">
<td bgcolor="#cc3300"></td>
<td bgcolor="#cc3300"><b><font color="white">Select a Tool:</font></b></td>
<td bgcolor="#cc3300"></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="3" width="1" border="0"></td>
</tr>
<tr>
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2" bgcolor="#669900" id="1"onmouseover="changebg1(this.id,'images/right_cal.gif')" onmouseout="changebg2(this.id)">
<a class="mainNavOff" " title="Calendar Section" href="calendar.asp">Calendar<br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>
<tr>
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2" id="2"onmouseover="changebg1(this.id,'images/right_news.gif')" onmouseout="changebg2(this.id)"><a class="mainNavOff" href="news.asp">News <br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>
<tr>
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2"id="3"onmouseover="changebg1(this.id,'images/right_dir.gif')" onmouseout="changebg2(this.id)"><a class="mainNavOff" title="Directory Section" href="directory.asp">Directory<br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>
<tr>
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2" id="4"onmouseover="changebg1(this.id,'images/right_links.gif')" onmouseout="changebg2(this.id)"><a class="mainNavOff" href="links.asp">Links<br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>
<tr>
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2" id="5"onmouseover="changebg1(this.id,'images/right_mp.gif')" onmouseout="changebg2(this.id)"><a class="mainNavOff" href="marketplace_new.asp">Market&nbsp;Place<br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>
<tr>
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2" id="6"onmouseover="changebg1(this.id,'images/right_forum.gif')" onmouseout="changebg2(this.id)"><a class="mainNavOff" href="QandA.asp">Platica / Forum<br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>
<tr valign="top">
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2" id="7"onmouseover="changebg1(this.id,'images/right_shared.gif')" onmouseout="changebg2(this.id)"><a class="mainNavOff" href="share.asp">Shared Files<br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f"><img src="images/spacer.gif" alt="spacer" height="1" width="1" border="0"></td>
</tr>
<tr valign="top">
<td bgcolor="#9acd32"><font size="1">&nbsp;</font></td>
<td colspan="2"><a class="mainNavOff" href="MemberSiteList.asp">Member&nbsp;Websites<br>
</a></td>
</tr>
<tr>
<td colspan="3" bgcolor="#2f4f4f" height="2"><img src="images/spacer.gif" alt="spacer" height="3" width="1" border="0"></td>
</tr>

</table>


If you guys wanna see what I'm doing with it, here's the link.

Click Here To View (http://www.greendaycommunity.org/testsite/default.asp)

The hover over cell im using are for the "TOOL" list on the left side. If you guys can help me out, please do.

I thought the code looked right, but the images aren't pre-loading. And now I'm on dial up while on Spring Break, so i can see a wait time for the images to load.

IKLOP
03-18-2005, 07:24 PM
you're missing a opening bracket:<script type="text/javascript">
<!--
if (document.images){
img1=new Image();
img1.src="images/right_cal.gif";
img2=new Image();
img2.src="images/right_news.gif";
img3=new Image();
img3.src="images/right_dir.gif";
img4=new Image();
img4.src="images/right_links.gif";
img5=new Image();
img5.src="images/right_mp.gif";
img6=new Image();
img6.src="images/right_forum.gif";
img7=new Image();
img7.src="images/right_shared.gif";
}
//-->
</script>

on a unrelated note, when I went to your site (in firefox), it wasn't rendered, just saw the source in the page, like the mime type was text or something.

scatteredbomb
03-19-2005, 02:11 AM
Well, thanks. Don't you hate when it's the little things that don't work.

And yea, the site won't work correctly where it's at because it's just on a test server i have. The site works fine across all platforms when it's on it's own server with all scripts running correctly from the server.

Thanks again!