Results 1 to 4 of 4

Thread: Image to video

  1. #1
    Join Date
    Apr 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Image to video

    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.

  2. #2
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Default

    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:

    HTML Code:
    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>

  3. #3
    Join Date
    Apr 2011
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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.

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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)

    Code:
    <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/jav...-innerHTML.php
    Corrections to my coding/thoughts welcome.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •