Hi,
Any folks in here know much about Javascript?
I am wanting to link to an .js file, to keep the head of my web page im building nice and clean. I cant figure out how to do it though.
This is what is in the <head> of my xhtml file:
[code]
<script language="javascript" type="text/javascript">
if(document.images){
one_off = new Image;
one_on = new Image;
one_off.src = "images/navigation/gallery_up.jpg"
one_on.src = "images/navigation/gallery_down.jpg"
two_off = new Image;
two_on = new Image;
two_off.src = "images/navigation/exhibitions_up.jpg"
two_on.src = "images/navigation/exhibitions_down.jpg"
three_off = new Image;
three_on = new Image;
three_off.src = "images/navigation/commissions_up.jpg"
three_on.src = "images/navigation/commissions_down.jpg"
four_off = new Image;
four_on = new Image;
four_off.src = "images/navigation/contact_up.jpg"
four_on.src = "images/navigation/contact_down.jpg"
}
else{
one_off = "";
one_on = "";
document.one = "";
two_off = "";
two_on = "";
document.two = "";
three_off = "";
three_off = "";
document.three = "";
four_off = "";
four_on = "";
document.four = "";
}
</script>
[/code]
and in the body;
[code]
<a href="gallery.html" onmouseover="document.one.src=one_on.src" onmouseout="document.one.src=one_off.src">
<img src="images/navigation/gallery_up.jpg" name ="one" alt="Gallery" width="96" height="240" border="0"/></a>
<a href="exhibitions.html" onmouseover="document.two.src=two_on.src" onmouseout="document.two.src=two_off.src">
<img src="images/navigation/exhibitions_up.jpg" name="two" alt="Exhibitions" width="96" height="240" border="0"/></a>
<a href="commissions.html" onmouseover="document.three.src=three_on.src" onmouseout="document.three.src=three_off.src">
<img src="images/navigation/commissions_up.jpg" name="three" alt="Commissions" width="96" height="240" border="0"/></a>
<a href="contact.html" onmouseover="document.four.src=four_on.src" onmouseout="document.four.src=four_off.src">
<img src="images/navigation/contact_up.jpg" name="four" alt="Contact" width="96" height="240" border="0"/></a>[/code]
what I would like to do, is copy the script located in the head, into its own .js file ('rollover.js') and just link to it like <script language="javascript" type="text/javascript" src="rollover.js">
What would I need to change in the body, so that it still works? I cant figure it out :(
