www.webdeveloper.com
Results 1 to 4 of 4

Thread: How can I use this program to start over again?

  1. #1
    Join Date
    Jul 2013
    Posts
    3

    How can I use this program to start over again?

    If the mouse is over on another picture it show's it but wont change it back when the mouse is over an another one.

    Wonder how would it go and change the mouseover for loverpicture.

    my code:

    <html>
    <head>
    <script type="text/javascript">

    function changepic()
    {
    document.getElementById("demo").style.top=400 ;
    }
    function changepic1()
    {
    document.getElementById("demo1").style.top=400;
    document.getElementById("demo1").style.left=400;

    }

    </script>
    </head>
    <body>
    <div start>
    <h1>My First Web Page</h1>

    <img id="demo" src="Megane.jpg" style="position:absolute; left: 400; top: 100; width: 80; height: 200;" onmouseover="changepic()"/>
    <img src="Megane.jpg" style="position:absolute; left: 400; top: 100; width: 80; height: 200;" onmouseover="changepic()"/>

    <img id="demo1" src="scenic.jpg" style="position:absolute; left: 200; top: 100; width: 80; height: 200;" onmouseover="changepic1()"/>

    <img src="scenic.jpg" style="position:absolute; left: 200; top: 100; width: 80; height: 200;" onmouseover="changepic1()"/>



    </body>
    </html>




  2. #2
    Join Date
    Jul 2013
    Posts
    3
    if the mouseover is on megane.jpg it changes it to megane.jpg but won't change it back again if the mouse has been over scenic.jpg. does this code need some kind of loop or goto statement to work right?

  3. #3
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,213
    You would use the onmouseover and onmouseout event triggers.

    Your function onmouseover would set the onmouseout event with the appropriate information to revert back to the original image.

    You will find plenty of examples in the forum if you search for them.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

  4. #4
    Join Date
    Jul 2013
    Posts
    3
    Thanks, I founded good examples and got it right. Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles