robertcathles
02-17-2006, 02:03 PM
Hello out there!
My name is Robert, and I have built my own website. The URL is http://uk.geocities.com/robcboff/index.html
I have created a navigation menu for my website, which I first copied from Apycom's applets. I had problems loading the applets from this website, so I created my own HTML and Java one. I spent ages working on it so I am really pleased with it!
One problem I've always had, however, is that the code for the navigation bar is wayyyy too much for the size of the page (46K). So I went looking around this website and some others for some alternative menus, found some, and then regenerated my navigation bar based on the java that came with them. I have saved 26K with this new script, but I have a problem: The images do not preload.
On my index.html page, I use an image hiding and displaying CSS + Javascript instead of preloading the images. An example:
<span class="nava">
<img src="nav-bg1.gif" id="no1a"><img src="nav-bg2.gif" style="display:none;" id="no1b"><img src="nav-bg3.gif" style="display:none;" id="no1c">
<a href="construct.html" class="nav"
onMouseOver="javascript:document.all.no1a.style.display='none';
javascript:document.all.no1b.style.display='inline';javascript:this.style.color='#3775FF';"
onMouseOut="javascript:document.all.no1a.style.display='inline';
javascript:document.all.no1b.style.display='none';
javascript:document.all.no1c.style.display='none';javascript:this.style.color='#000099';"
onMouseDown="javascript:document.all.no1b.style.display='none';
javascript:document.all.no1c.style.display='inline';"
> Construction List </a>
</span>
With my new code, I have created this page: http://uk.geocities.com/robcboff/index2.html
But the problem is that the images (I have highlighted them in red) do not preload.
The new script is:
<script language="JavaScript1.2">
//Thanks to http://www.dynamicdrive.com/dynamicindex1/highlightmenu2.htm
//Also great thanks to http://www.faqts.com/knowledge_base/view.phtml/aid/4005
function over_effect(e,state){
if (document.all)
source4=event.srcElement
else if (document.getElementById)
source4=e.target
if (source4.className=="nav")
source4.style.backgroundImage = state == 'none' ? 'none' : 'url(' + state + ')';
else{
while(source4.tagName!="TABLE"){
source4=document.getElementById? source4.parentNode : source4.parentElement
if (source4.className=="nav")
source4.style.backgroundImage = state == 'none' ? 'none' : 'url(' + state + ')';
}
}
}
</script>
And the table to load them is:
<table width="138" cellspacing="0" cellpadding="0" onMouseover="over_effect(event,'nav-bg2.gif')" onMouseout="over_effect(event,'nav-bg1.gif')" onMousedown="over_effect(event,'nav-bg3.gif')" onMouseup="over_effect(event,'nav-bg3.gif')" style="border-left:1px solid #F39333;border-top:1px solid #F39333;border-right:1px solid #AF7133;border-bottom:1px solid #BF7933;">
And an example of one link is:
<tr><td class="nav"><a href="construct.html">Construction List</a></td></tr>
I have tried some simple javascripts to try and preload them, but to no success. Can you please help me solve this problem?
Thanks very much for your time :) I was really pleased when I made this new script but when I checked to see if worked for real instead of locally on my computer, I got very angry!!! :mad:
So if anyone can help me (please!) then I would be really happy! :)
My name is Robert, and I have built my own website. The URL is http://uk.geocities.com/robcboff/index.html
I have created a navigation menu for my website, which I first copied from Apycom's applets. I had problems loading the applets from this website, so I created my own HTML and Java one. I spent ages working on it so I am really pleased with it!
One problem I've always had, however, is that the code for the navigation bar is wayyyy too much for the size of the page (46K). So I went looking around this website and some others for some alternative menus, found some, and then regenerated my navigation bar based on the java that came with them. I have saved 26K with this new script, but I have a problem: The images do not preload.
On my index.html page, I use an image hiding and displaying CSS + Javascript instead of preloading the images. An example:
<span class="nava">
<img src="nav-bg1.gif" id="no1a"><img src="nav-bg2.gif" style="display:none;" id="no1b"><img src="nav-bg3.gif" style="display:none;" id="no1c">
<a href="construct.html" class="nav"
onMouseOver="javascript:document.all.no1a.style.display='none';
javascript:document.all.no1b.style.display='inline';javascript:this.style.color='#3775FF';"
onMouseOut="javascript:document.all.no1a.style.display='inline';
javascript:document.all.no1b.style.display='none';
javascript:document.all.no1c.style.display='none';javascript:this.style.color='#000099';"
onMouseDown="javascript:document.all.no1b.style.display='none';
javascript:document.all.no1c.style.display='inline';"
> Construction List </a>
</span>
With my new code, I have created this page: http://uk.geocities.com/robcboff/index2.html
But the problem is that the images (I have highlighted them in red) do not preload.
The new script is:
<script language="JavaScript1.2">
//Thanks to http://www.dynamicdrive.com/dynamicindex1/highlightmenu2.htm
//Also great thanks to http://www.faqts.com/knowledge_base/view.phtml/aid/4005
function over_effect(e,state){
if (document.all)
source4=event.srcElement
else if (document.getElementById)
source4=e.target
if (source4.className=="nav")
source4.style.backgroundImage = state == 'none' ? 'none' : 'url(' + state + ')';
else{
while(source4.tagName!="TABLE"){
source4=document.getElementById? source4.parentNode : source4.parentElement
if (source4.className=="nav")
source4.style.backgroundImage = state == 'none' ? 'none' : 'url(' + state + ')';
}
}
}
</script>
And the table to load them is:
<table width="138" cellspacing="0" cellpadding="0" onMouseover="over_effect(event,'nav-bg2.gif')" onMouseout="over_effect(event,'nav-bg1.gif')" onMousedown="over_effect(event,'nav-bg3.gif')" onMouseup="over_effect(event,'nav-bg3.gif')" style="border-left:1px solid #F39333;border-top:1px solid #F39333;border-right:1px solid #AF7133;border-bottom:1px solid #BF7933;">
And an example of one link is:
<tr><td class="nav"><a href="construct.html">Construction List</a></td></tr>
I have tried some simple javascripts to try and preload them, but to no success. Can you please help me solve this problem?
Thanks very much for your time :) I was really pleased when I made this new script but when I checked to see if worked for real instead of locally on my computer, I got very angry!!! :mad:
So if anyone can help me (please!) then I would be really happy! :)