LJ2K
03-30-2006, 09:52 PM
I've just finished adding the script to my site and can't figure out why the images aren't showing on the page. This the code I used:
In the head;-
<script type="text/javascript">
//Specify image paths and optional link (set link to "" for no link):
var dynimages=new Array()
dynimages[0]=["sample1.png", ""]
dynimages[1]=["sample2.png", ""]
dynimages[2]=["sample3.png", ""]
dynimages[3]=["sample4.png", ""]
dynimages[4]=["sample5.png", ""]
dynimages[5]=["sample6.png", ""]
//Preload images ("yes" or "no"):
var preloadimg="yes"
//Set optional link target to be added to all images with a link:
var optlinktarget=""
//Set image border width
var imgborderwidth=0
//Optionally, change 1.0 and 0.7 below to affect Wipe gradient size and duration in seconds in IE5.5+:
var filterstring="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)"
///////No need to edit beyond here/////
if (preloadimg=="yes"){
for (x=0; x<dynimages.length; x++){
var myimage=new Image()
myimage.src=dynimages[x][0]
}
}
function returnimgcode(theimg){
var imghtml=""
if (theimg[1]!="")
imghtml='<a href="'+theimg[1]+'" target="'+optlinktarget+'">'
imghtml+='<img src="'+theimg[0]+'" border="'+imgborderwidth+'">'
if (theimg[1]!="")
imghtml+='</a>'
return imghtml
}
function modifyimage(loadarea, imgindex){
if (document.getElementById){
var imgobj=document.getElementById(loadarea)
if (imgobj.filters && window.createPopup){
imgobj.style.filter=filterstring
imgobj.filters[0].Apply()
}
imgobj.innerHTML=returnimgcode(dynimages[imgindex])
if (imgobj.filters && window.createPopup)
imgobj.filters[0].Play()
return false
}
}
</script>
In the body;-
<CENTER><a href="sample1.png" onMouseover="modifyimage('dynloadarea', 0)"><IMG SRC="sample1.png"></a>
<a href="sample2.png" onMouseover="modifyimage('dynloadarea', 1)"><IMG SRC="sample2.png"></a>
<a href="sample3.png" onMouseover="modifyimage('dynloadarea', 2)"><IMG SRC="sample3.png"></a>
<a href="sample4.png" onMouseover="modifyimage('dynloadarea', 3)"><IMG SRC="sample4.png"></a>
<a href="sample5.png" onMouseover="modifyimage('dynloadarea', 4)"><IMG SRC="sample5.png"></a>
<a href="sample6.png" onMouseover="modifyimage('dynloadarea', 5)"><IMG SRC="sample6.png"></a>
<br>
<div id="dynloadarea" style="width:80px;height:225px"></div></CENTER>
The images are in the root directory with the page, but aren't showing up... Anyone had a similar problem (or noticed a mistake I've missed)? :eek: :confused:
Oh, by the way, the "big grin" image shouldn't be there, it's actually the : and D that are right next to each other!
In the head;-
<script type="text/javascript">
//Specify image paths and optional link (set link to "" for no link):
var dynimages=new Array()
dynimages[0]=["sample1.png", ""]
dynimages[1]=["sample2.png", ""]
dynimages[2]=["sample3.png", ""]
dynimages[3]=["sample4.png", ""]
dynimages[4]=["sample5.png", ""]
dynimages[5]=["sample6.png", ""]
//Preload images ("yes" or "no"):
var preloadimg="yes"
//Set optional link target to be added to all images with a link:
var optlinktarget=""
//Set image border width
var imgborderwidth=0
//Optionally, change 1.0 and 0.7 below to affect Wipe gradient size and duration in seconds in IE5.5+:
var filterstring="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)"
///////No need to edit beyond here/////
if (preloadimg=="yes"){
for (x=0; x<dynimages.length; x++){
var myimage=new Image()
myimage.src=dynimages[x][0]
}
}
function returnimgcode(theimg){
var imghtml=""
if (theimg[1]!="")
imghtml='<a href="'+theimg[1]+'" target="'+optlinktarget+'">'
imghtml+='<img src="'+theimg[0]+'" border="'+imgborderwidth+'">'
if (theimg[1]!="")
imghtml+='</a>'
return imghtml
}
function modifyimage(loadarea, imgindex){
if (document.getElementById){
var imgobj=document.getElementById(loadarea)
if (imgobj.filters && window.createPopup){
imgobj.style.filter=filterstring
imgobj.filters[0].Apply()
}
imgobj.innerHTML=returnimgcode(dynimages[imgindex])
if (imgobj.filters && window.createPopup)
imgobj.filters[0].Play()
return false
}
}
</script>
In the body;-
<CENTER><a href="sample1.png" onMouseover="modifyimage('dynloadarea', 0)"><IMG SRC="sample1.png"></a>
<a href="sample2.png" onMouseover="modifyimage('dynloadarea', 1)"><IMG SRC="sample2.png"></a>
<a href="sample3.png" onMouseover="modifyimage('dynloadarea', 2)"><IMG SRC="sample3.png"></a>
<a href="sample4.png" onMouseover="modifyimage('dynloadarea', 3)"><IMG SRC="sample4.png"></a>
<a href="sample5.png" onMouseover="modifyimage('dynloadarea', 4)"><IMG SRC="sample5.png"></a>
<a href="sample6.png" onMouseover="modifyimage('dynloadarea', 5)"><IMG SRC="sample6.png"></a>
<br>
<div id="dynloadarea" style="width:80px;height:225px"></div></CENTER>
The images are in the root directory with the page, but aren't showing up... Anyone had a similar problem (or noticed a mistake I've missed)? :eek: :confused:
Oh, by the way, the "big grin" image shouldn't be there, it's actually the : and D that are right next to each other!