Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   image+description problem (http://www.go4expert.com/forums/imagedescription-problem-t26889/)

2007160935 9Oct2011 14:31

image+description problem
 
ths code shows the photoes under preloadimages, but I cant add description out of it, can somebody pls help me where do I go wrong here?

HTML Code:

<html>
<head>
<script>
function changeimage(towhat,url){
if (document.images){
document.images.targetimage.src=towhat.src
gotolink=url
}
}
function warp(){
window.location=gotolink
if (type=="radio" && myForm.elements[0].checked){
        document.write("test1");
}
}
</script>

        <! -- Automatic -->
<script language="JavaScript1.1">
var myimages=new Array()
var gotolink="#"
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
myimages[i].value=document.write("descriptions.arguments[i]")
}
}
preloadimages("img/img1.gif","img/img2.gif")

</script>


</head>
<body>

<p href="javascript:warp()"><img src="img/whale.gif" name="targetimage" width="500" height="190" border=0 ><br /><p>test</p></p>

<div><input type="radio" title="Suiteliving1" name="suiteliving" value="1" CHECKED onClick="changeimage(myimages[0],this.href)">&nbsp;a. Whaledive<img src="img/packages/image1.gif" width="285" height="150"/></div>

</body>
</html>


pein87 11Oct2011 02:46

Re: image+description problem
 
Code:

function warp(){
window.location=gotolink
if (type=="radio" && myForm.elements[0].checked){
        document.write("test1");
}
}

Your trying to use a variable that is private to its original function. gotolink is not a global variable and is private to the functions its defined in. Also try using object notation this might help you better with your code. I won't write the code myself but I will give you advice. Create a function that has two params that are arrays. Each on will hold different info. One the images url, and the other the details.


All times are GMT +5.5. The time now is 00:24.