Play sound with javascript

前端 未结 3 1188
闹比i
闹比i 2021-01-13 21:43

I want to create a table with string and button(that play sound) in each row and every button play a different sound.

i want to do it with this method :



        
3条回答
  •  我在风中等你
    2021-01-13 21:59

    You could use a javascript framework to make your code easier. Take a look at the Scriptaculous page:

    http://madrobby.github.com/scriptaculous/sound/

    To my knowledge 'jQuery' is not so well appointed for sound, however, I guess that there are plugins for that.

    Then you could put your sound files as links or 'rel' links, have observers on the buttons and play them with quite clean HTML and a little scripting.

提交回复
热议问题