javascript - Won't change image? -
javascript code:
function changeimage(src, imgmap) { document.getelementbyid('screenshots').src = src; if (imgmap != null) { var newmap = document.getelementbyid(imgmap); var origin = document.getelementbyid("map1"); origin.innerhtml = newmap.innerhtml; } curser_normal(); } function curser_normal() { document.body.style.cursor = 'auto'; }
html code:
<div class="centeredimage"> <img class="logo" id="screenshots" border="0" src=".\pics\test1.png" usemap="#map1"> </div> <map id="map1"> <area shape="rect" coords="103,224,169,242" onclick="changeimage('.\pics\test2.png', 'nextpage');" onmouseover="cursor_wait();" onmouseout="curser_normal();"> <area shape="rect" coords="30,92,56,116" onclick="changeimage('.\pics\test3.png', 'anotherpage');" onmouseover="cursor_wait();" onmouseout="curser_normal();"> </map>
the problem lies within function call. not possible give url argument now. function use following url: .pics est2.png
input. can following thing:
change \
:
changeimage('.\pics\test2.png', 'nextpage'); // results in: .pics est2.png
to /
:
changeimage('./pics/test2.png', 'nextpage'); // results in: ./pics/test2.png
in case have working
Comments
Post a Comment