How can we disable replay for an audio in HTML5 if we have a designated button for playing the audio in IE?
-
You can see detail of this question here at StackOverflow http://stackoverflow.com/questions/24416981/how-do-de-activate-the-play-button-in-ie-after-the-audio-has-been-played <audio controls="" id="audio2" style="display:none"><source src="http://langcomplab.net/Honey_Gatherers_Master.webm" style="width:50%" type="audio/webm" /> <source src="http://langcomplab.net/Honey_Gatherers_Master.mp3" style="width:50%" type="audio/mp3" /> Your browser doesn't support this audio format.</audio></div><p> </p><div><button name="play" onclick="disabled=true" style="height:25px; width:200px" type="button">Play Story</button></div>
-
Answer:
I'm not sure why IE doesn't do what you want but I guess one never truly understands why IE responds like it does. However, you might want to combine the two actions in the questionClick function. (Maybe that onClick event handler stops the onClick attribute from firing) For example: Qualtrics.SurveyEngine.addOnload(function() { /*Place Your Javascript Below This Line*/ var aud = document.getElementById('audio2'); this.questionclick = function(event,element){ if((element.type == "button") && (http://element.name == "play")) { aud.play(); // remove the element element.parentNode.removeChild(element); // or set it to disabled, what you like element.disabled = true; } } }); Don't forget to remove the onClick attribute from the button: <div><button name="play" style="height:25px; width:200px" type="button">Play Story</button></div> You can also set a variable on pageload. Check it before you start playing and then set it again. Example: // Set a variable var hasPlayed = false; Qualtrics.SurveyEngine.addOnload(function() { /*Place Your Javascript Below This Line*/ var aud = document.getElementById('audio2'); this.questionclick = function(event,element){ if((element.type == "button") && (http://element.name == "play")) { // Check if audio hasn't played before if(hasPlayed == false) aud.play(); // Flip the variable to make sure it won't play on next click hasPlayed = true; } } });
Maarten Wolzak at Quora Visit the source
Related Q & A:
- How can I disable default blocks in Drupal 7 without touching the Blocks Config admin?Best solution by Drupal Answers
- How can I remove a casset tape from my car player? It is a 2003 Hyundai Sonota. Does anyone else this problem?Best solution by Yahoo! Answers
- How can I disable the new Yahoo popup?Best solution by malwaretips.com
- How can I disable caching and shadowing?
- How can I disable this Auto-brightness feature?Best solution by Quora
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.