Nieuw lid |
|
Ik heb twee javascripts gecombineerd zodat wanneer iemand in het menu op een link klikt er random een image verschijnt. Echter, wanneer je op de link klikt verdwijnt alle content en zie je alleen nog de random image. Kan iemand me helpen dit te verhelpen?
Hieronder het javascript in het head-gedeelte:
<script language="JavaScript" type="text/JavaScript">
<!--
var theImages = new Array()
theImages[0] = 'images/layout/foto1.jpg'
theImages[1] = 'images/layout/foto2.jpg'
theImages[2] = 'images/layout/foto3.jpg'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
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_setTextOfLayer(objName,x,newText) { //v4.01
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape('<img src="'+theImages[whichImage]+'">')); document.close();}
else innerHTML = unescape('<img src="'+theImages[whichImage]+'">');
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript"> <!-- var theImages = new Array() theImages[0] = 'images/layout/foto1.jpg' theImages[1] = 'images/layout/foto2.jpg' theImages[2] = 'images/layout/foto3.jpg' var j = 0 var p = theImages.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Image() preBuffer[i].src = theImages[i] } var whichImage = Math .round(Math .random ()*(p -1)); 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_setTextOfLayer(objName,x,newText) { //v4.01 if ((obj=MM_findObj(objName))!=null) with (obj) if (document.layers) {document.write(unescape('<img src="'+theImages[whichImage]+'">')); document.close();} else innerHTML = unescape('<img src="'+theImages[whichImage]+'">'); } //--> </script>
in de body bij de link:
onClick="MM_setTextOfLayer('main','')"
onClick="MM_setTextOfLayer('main','')"
|