Hi,
I am just learning php, and am currently converting some jsp pages to php. I used the follwing code in jsp to toggle between two images
<SCRIPT type="text/javascript" language=javascript>
function toggle(imagename,src1,src2){
if(document.images && document.images[imagename])
{
image1=new Image;
image1.src=src1;
if(document.images[imagename].src != image1.src){document.images[imagename].src = image1.src}
else{document.images[imagename].src=src2}
}
}
</SCRIPT>
start code snippet.............
out.println("<A");
out.println("onclick=\"toggle('" + child + "image','images/" + type + ".jpg','images/" + childimg "');return(false);\"");
out.println("><img src='images/" + type + ".jpg' alt='' name=" + child + "image></a>");
out.println("<input type=hidden name=" + child + " value='" + childimg + "'>");
end code snippet...............
I have tried many different ways to achieve this in php, but nothing works. This is my latest attempt
start code snippet.............
print("<A href=\"javascript:;\" onclick=");
echo "\"if(document.images && document.images[" . $child . "image])\n";
echo " {\n";
echo " image1=new Image;\n";
echo " image1.src=images/$type.jpg;\n";
echo " if(document.images[" . $child . "image].src != image1.src){document.images[" . $child . "image].src = image1.src}\n";
echo " else{document.images[" . $child . "image].src=images/$childimg}\n";
echo " }\n";
echo "};\n";
echo "return(false);\">\n";
print("<img src='images/$type.jpg' alt='' name=" . $child . "image>\n</a>\n");
print("<input type=hidden name=$child value='$childimg'>\n");
end code snippet.............
Could someone please let me know how to do this
Cheers Barb
-- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php