Log in

View Full Version : Image to video



jojo_molat
04-21-2011, 05:27 PM
I was searching on internet and I found a html code which is used when we want change image clicking on image.But I want to have that when image is clicked , image changes to video.For example , I want to have when my image of some car is clicked it changes to video , so I can watch video after seeing an image.If someone knows how to do that please post the html code.

mlegg
04-21-2011, 08:17 PM
Are you saying that you just want to post an image that is a clickable link to a video? You put the link to the video before the code for the image, like below:


An image that is a link:
<a href="http://link to your video.com">
<img src="angry.gif" alt="Go to W3Schools.com" width="32" height="32" border="0" />
</a>

jojo_molat
04-21-2011, 11:00 PM
Thank you , but I want when image is clicked that on the very same place shows video , I don't want to open a video in new tab or window.To conclude , when image is clicked image is replaced with an video.

bluewalrus
04-21-2011, 11:55 PM
You'll have to use javascript HTML can't do it. It'll probably be easiest to put a div around it too. Something like this (not exact, not tested)



<script type="text/javascript">
function change_image(id) {
document.GetElementByID(id).innerHTML = "VIDEO PLAYER CODE";
}
</script>
<div id="imgtovid" onclick="change_image(imgtovid);"><img src="" /></div>

You can find more info here http://www.tizag.com/javascriptT/javascript-innerHTML.php