Playing a sound onmouseover

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newsteve1
    New Member
    • Aug 2007
    • 12

    #1

    Playing a sound onmouseover

    Hi,

    On a rollover I am looking to change an image AND have a sound play. I was hoping to do this with javascript. The image is done but the sound - I have been looking into it (sound with javascript) and it seems like this is a thing of the past - and is difficult to do cross browser etc. Anyone have any info on whether this is possible, or how difficult it would be? I was hoping to do this without flash, but will use it if no other options present themselves.

    Thanks for you help,
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Steve.

    To do this, you'd have to embed a sound file into the page and then call the element's play() method when mousing over the image (and stop() on mouseout, maybe). No promises as to synchronization , though.

    Comment

    • newsteve1
      New Member
      • Aug 2007
      • 12

      #3
      and this is cross-browser compliant you reckon?




      Originally posted by pbmods
      Heya, Steve.

      To do this, you'd have to embed a sound file into the page and then call the element's play() method when mousing over the image (and stop() on mouseout, maybe). No promises as to synchronization , though.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Steve.

        Originally posted by newsteve1
        and this is cross-browser compliant you reckon?
        Presumably; all browsers support embedded objects, and they are controllable. This is about the extent of my knowledge in this area, though.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          The object element is the standard element to use. See link. Read up on the object element reference (and other refs.) on the left hand side menu.

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Changed thread title to better describe the problem.

            Comment

            • Logician
              New Member
              • Feb 2007
              • 210

              #7
              Originally posted by newsteve1
              Hi,

              On a rollover I am looking to change an image AND have a sound play. I was hoping to do this with javascript. The image is done but the sound - I have been looking into it (sound with javascript) and it seems like this is a thing of the past - and is difficult to do cross browser etc. Anyone have any info on whether this is possible, or how difficult it would be? I was hoping to do this without flash, but will use it if no other options present themselves.
              If you're still stuck, you could try PlayMedia, which works most of the time.

              Comment

              • jx2
                New Member
                • Feb 2007
                • 228

                #8
                sound in javascript i think you might want to see this one

                Comment

                Working...