Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Stuck with external .js files


Andrew_Thomas - 7:10 pm on Oct 21, 2002 (gmt 0)


Ok, im trying to create a site where my content is at the top of the page. So ive used CSS and header and footer files.

The problem is, ive used Macromedia Dreameaver Rollover buttons, which are in the header.asp, i would like to put the <script> into an external .js file, but each time i seperate the code i get an error,

here is the code :-

<script>
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/MainTopPanel.jpg" width="760" height="94" /></td>
</tr>
<tr>
<td><a href="index1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','images/nav%20buttons/Home%20Y.jpg',1)"><img src="images/nav%20buttons/Home%20W.jpg" alt="home" name="Image2" width="259" height="24" border="0" id="Image2" /></a><a href="biography.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','images/nav%20buttons/Biog%20Y.jpg',1)"><img src="images/nav%20buttons/Biog%20W.jpg" alt="biography" name="Image4" width="125" height="24" border="0"></a><a href="album.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','images/nav%20buttons/Album%20Y.jpg',1)"><img src="images/nav%20buttons/Album%20W.jpg" alt="albums" name="Image3" width="92" height="24" border="0"></a><a href="news.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','images/nav%20buttons/News%20Y.jpg',1)"><img src="images/nav%20buttons/News%20W.jpg" alt="news and gigs" name="Image5" width="128" height="24" border="0"></a><a href="contact.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','images/nav%20buttons/Contact%20Y.jpg',1)"><img src="images/nav%20buttons/Contact%20W.jpg" alt="contacts" name="Image6" width="156" height="24" border="0"></a></td>
</tr>
</table>

My body tags etc are in the main index.asp.

Can someone please explain if it is possable to seperate the above script code and place it into a .js file, ive tried but with no luck

thanks


Thread source:: http://www.webmasterworld.com/javascript/212.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com