document.write loop not working remotely
The problem: doesnt output an image. image name (1).jpg up to (42).jpg
<script type=text/javascript>
var i=1;
while (i<=42) {
document.write("<div style=min-height:200px; onmouseover=\"innerHTML=\'<img style=width:800px; src=(");
document.write(i);
docum开发者_高级运维ent.write(").jpg/>\'\">Hover</div>" + i);
i++;
}
</script>
Additional info:
- tried this locally with wamp and it worked fine
This is the result of the above code:
<div style="min-height:200px;" onmouseover="innerHTML='<img style=width:800px; src=(1).jpg/>'"><img style="width:800px;" src="(1).jpg/"></div>
What do you mean that is not working? If you mean that does not display the images after the hover then you have to correct the image path.
Look if the images are located in the same folder with the page that run that code, otherwhise correct the path.
精彩评论