Results 1 to 2 of 2

Thread: Where is my mistake

Hybrid View

  1. #1
    Join Date
    Oct 2011
    Hamilton, Ontario

    Where is my mistake

    wanted to use the following script to be able to play different sounds depending on which text is clicked, not sure where my mistake is, but when the page loads one of the sounds plays automatically, even with the autoplay="false".... and when I click on the text nothing plays at all... any suggestions?

    <script type="text/javascript">
    var example=document.getElementById("sound");
    function EvalSound(nusound) {
    example.setAttribute('src', nusound)


    <font size="3" onclick="javascript:EvalSound(min2nd.wav);"/><u>minor 2nd</u></font>
    <font size="3" onclick="javascript:EvalSound(maj6th.wav);"/><u>Major 6th</u></font>
    <embed src="min2nd.wav" autostart="false" width=1 height=1 id="sound" enablejavascript="true">


  2. #2
    Join Date
    Oct 2011
    Hamilton, Ontario
    also tried this:

    <script type="text/javascript">
    var example=document.getElementById('sound');

    and the html:
    <font size="3" onclick="javascript:example.setAttribute('src', 'min2nd.wav'); example.Play();"/><u>minor 2nd</u></font>
    <font size="3" onclick="javascript:example.setAttribute('src', 'maj6th.wav'); example.Play();"/><u>Major 6th</u></font>

    didn't work.. still can't figure out how to do this

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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