Depends on where & how you want to display the image but:
[tt]
<script>
var img_file = 'myimage.gif';
function show_image(){
document.getElementById('img_place_holder').innerHTML = '<img src="' + img_file + '">';
document.getElementById('img_place_holder').style.visibility = 'visible';
}
</script>
<!-- This div tag acts as an image placeholder -->
<div id="img_place_holder" style="visibility:hidden"></div>
<input type="button" value="clicky" onClick="show_image()">
1)first u create an image tag:-
<img src="xyz.jpg">
2)store it in a javascript variable:-
var a=<img src="xyz.jpg">
3)u can use this variable to display the image whenever u want:-
document.write(a)
hope this is what u were looking for!all the best!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.