SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Heg's Avatar
    Join Date
    Dec 2001
    Location
    AZ
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mouseover img swap AND sound

    (I accidentally posted this in the HTML section already, but was unable to delete it).



    Is it possible to have a mouseover event do two things at once? What I want to do is have a different image show on mouseover AND have a quick .wav file play. Can this be done?

    Below is the code to do it separately, I just want to know if there is a way to combine the image swap and sound on one mouseover.

    --------------------------------------

    <head>
    <script language="javascript1.1">
    <!--

    contact1=new Image(100,100)
    contact1.src="images/contact1.jpg"
    contact1_neg=new Image(100,100)
    contact1_neg.src="images/contact1_neg.jpg"
    //-->
    </script>

    <script>
    <!--
    function filter(imagename,objectsrc){
    if (document.images)
    document.images[imagename].src=eval(objectsrc+".src")
    }
    //-->
    </script>
    </head>

    <body>

    <EMBED SRC="Camera.wav" HIDDEN=TRUE AUTOSTART="false" MASTERSOUND NAME="camera">


    <a href="#"
    onmouseover="filter('x','contact1_neg')"
    onmouseout="filter('x','contact1')">
    <img src="images/contact1.jpg" name="x" border=0 width=100 height=100></a>

    <hr>


    <A HREF="#"
    onMouseOver="javascript:document.camera.play()">

    <img src="images/contact1.jpg" border=0 width=100 height=100>
    </A>

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes

    <script>
    function doTwoThings()
    {
    filter('x','contact1_neg');
    document.camera.play();
    }
    </script>

    ...

    <A HREF="#" onMouseOver="doTwoThings()">
    <img src="images/contact1.jpg" border=0 width=100 height=100>
    </A>

  3. #3
    SitePoint Enthusiast Heg's Avatar
    Join Date
    Dec 2001
    Location
    AZ
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks jofa!


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
  •