Please don't post links. That's not allowed here.
I've rre-written all the JavaScript I'd written, I hadn't known that document.write would act that way when in a function.
Here is an example page with the following:
1) Flash that loads last.
2) Trio Mousetrail
3) Image preloading
All are functional and all you have to do is make sure teh paths in the Flash code are altered accordingly. I set them to full URLs so that I could test it.
Here ya go, all of them are tested and working.
Code:<html>
<head>
<script language="JavaScript">
<!--
/*
Trio Script by Kurt Grigg - http://www.btinternet.com/~kurt.grigg/javascript
Script featured on Able2Know.com
Find free scripts & get free help: http://search.able2know.com/web_development/scripts/
*/
//Choose colours and size of effect !!
a_Colour='#ff0000';
b_Colour='#ffffff';
c_Colour='#0000ff';
size=50;
n=7;
//Alter nothing below !!
var n6=(navigator.appName == "Netscape" && parseFloat(navigator.appVersion) >= 5)?true:false;
var n4=(document.layers);
var o6=(navigator.appName.indexOf("Opera") != -1)?true:false;
var ie=(document.all);
if (n6&&n > 4) n=4;//N6 struggles over 4?
dy=new Array();
dx=new Array();
cstep=0;
step=0.2;
xpos=0;
ypos=0;
if (n4){
for (i = 0; i < n; i++){
document.write('<layer name=x'+i+' top=0 left=0 width='+i/2+' height='+i/2+' bgcolor='+a_Colour+'></layer>');
document.write('<layer name=y'+i+' top=0 left=0 width='+i/2+' height='+i/2+' bgcolor='+b_Colour+'></layer>');
document.write('<layer name=z'+i+' top=0 left=0 width='+i/2+' height='+i/2+' bgcolor='+c_Colour+'></layer>');
}
}
else{
if (ie)
document.write('<div id="con" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i = 0; i < n; i++){
document.write('<div id=x'+i+' style="position:absolute;top:0px;left:0px;width:'+i/2+';height:'+i/2+';background:'+a_Colour+';font-size:'+i/2+'"></div>');
document.write('<div id=y'+i+' style="position:absolute;top:0px;left:0px;width:'+i/2+';height:'+i/2+';background:'+b_Colour+';font-size:'+i/2+'"></div>');
document.write('<div id=z'+i+' style="position:absolute;top:0px;left:0px;width:'+i/2+';height:'+i/2+';background:'+c_Colour+';font-size:'+i/2+'"></div>');
}
if (ie) document.write('</div></div>');
}
if (n4||n6){
window.captureEvents(Event.MOUSEMOVE);
function mouse1(ev){
ypos = ev.pageY+16-window.pageYOffset;
xpos = ev.pageX+6;
}
if (n4) window.onMouseMove=mouse1;
else document.onmousemove=mouse1;
}
if (ie||o6){
function mouse2(){
ypos = (ie)?event.clientY+16:event.clientY+16-window.pageYOffset;
xpos = event.clientX+6;
}
document.onmousemove=mouse2;
}
function leaders(){
e=360/3;
for (i = 0; i < 3; i++){
dy[i]=ypos+size*Math.cos(cstep+i*e*Math.PI/180)*Math.sin((cstep+i*25)/2);
dx[i]=xpos+size*Math.sin(cstep+i*e*Math.PI/180)*Math.sin((cstep+i*25)/2)*Math.sin(cstep/4);
}
cstep+=step;
setTimeout('leaders()',10);
}
function assign(){
f=(ie)?0:window.pageYOffset;
if (ie) con.style.top=document.body.scrollTop;
for (i=0; i < n; i++){
var temp1 = (n4)?document.layers["x"+i]:document.getElementById("x"+i).style;
var temp2 = (n4)?document.layers["y"+i]:document.getElementById("y"+i).style;
var temp3 = (n4)?document.layers["z"+i]:document.getElementById("z"+i).style;
if (i < n-1){
var temp4 = (n4)?document.layers["x"+(i+1)]:document.getElementById("x"+(i+1)).style;
var temp5 = (n4)?document.layers["y"+(i+1)]:document.getElementById("y"+(i+1)).style;
var temp6 = (n4)?document.layers["z"+(i+1)]:document.getElementById("z"+(i+1)).style;
temp1.top = parseInt(temp4.top);
temp1.left = parseInt(temp4.left);
temp2.top = parseInt(temp5.top);
temp2.left = parseInt(temp5.left);
temp3.top = parseInt(temp6.top);
temp3.left = parseInt(temp6.left);
}
else{
temp1.top=dy[0]+f;temp1.left=dx[0];
temp2.top=dy[1]+f;temp2.left=dx[1];
temp3.top=dy[2]+f;temp3.left=dx[2];
}
}
setTimeout("assign()",10);
}
function Start(){
leaders();
assign();
}
// -->
</script>
<script type='text/javascript'>
<!--
function specialOnload()
{
Start();
MM_preloadImages( 'images/pages/pg1bkgnd.gif','images/nav2/navbar3a_r1_c2_f3.jpg','images/nav2/navbar3a_r1_c2_f2.jpg','images/nav2/navbar3a_r1_c3_f3.jpg','images/nav2/navbar3a_r1_c3_f2.jpg','images/nav2/navbar3a_r1_c5_f3.jpg','images/nav2/navbar3a_r1_c5_f2.jpg','images/nav2/navbar3a_r1_c6_f3.jpg','images/nav2/navbar3a_r1_c6_f2.jpg','images/nav2/navbar3a_r1_c8_f2.jpg');
}
// -->
</script>
<style type="text/css">
<!--
.bgimage {
background-image: url(images/pages/pg1bkgnd.gif);
background-repeat: no-repeat;
background-position: left top;
}
.bodycopy {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
font-style: normal;
line-height: 120%;
font-weight: bold;
color: #000000;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
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_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
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_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>
</head>
<body onLoad="specialOnload();">
text
<script>
<!--
if ((document.getElementById || document.all) && document.images)
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="acs" width="384" height="186" id="acs"><param name="movie" value="http://www.flamingjava.co.za/acs/acs_anim.swf"><param name="quality" value="high"><param name="LOOP" value="false"><embed src="http://www.flamingjava.co.za/acs/acs_anim.swf" width="384" height="186" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="acs" swliveconnect="true"></embed></object>');
}
// -->
</script>
text
</body>
</html>