HTML and CSS Reference
In-Depth Information
an alert() message and then return from the function, effectively halting execution. While
this is not a very robust form of error handling, it will work for the sake of this example:
iif ( audioType == "" ) {
alert ( "no audio support" );
return
return ;
}
audioElement . setAttribute ( "src" , "song1." + audioType );
Finally,likewedidwithvideo,wewilllistenforthe canplaythrough eventof audioElement
so that we know when the sound is ready to play:
audioElement . addEventListener ( "canplaythrough" , audioLoaded , false
false );
Search WWH ::




Custom Search