HTML | DOM Audio load() Method
The Audio load() method is used for reload the audio element. The Audio load() method is used to update the audio element after changing the source or other settings. The Audio load() method does not accept any parameters and does not return any values.
Syntax
audio.load()
Example:
html
<!DOCTYPE html> < html > < body style = "text-align:center;" > < h1 style = "color:green" >GeeksforGeeks</ h1 > < h2 >HTML DOM Audio load() Method</ h2 > < button onclick = "my_Audio()" type = "button" > Change Audio </ button > < br > < audio id = "my_Audio" controls autoplay> < source id = "mp4_src" src = type = "audio/mp3" > < source id = "ogg_src" src = type = "audio/ogg" > </ audio > < script > function my_Audio() { document.getElementById("ogg_src").src = document.getElementById("mp4_src").src = document.getElementById("my_Audio").load(); } </ script > </ body > </ html > |
Output:
Supported Browsers: The browsers supported by HTML DOM Audio load() Method are listed below:
- Google Chrome
- Opera
- Mozilla Firefox
Please Login to comment...