2
소리 onclick 이벤트를 재생하고 싶습니다. 파이어 폭스와 다른 브라우저에서는 사파리가 아닌 사운드를 재생할 수있는 코드가 있습니다. 다음은 코드입니다. 사파리는 "thissound.Play" [undefined ] is not a function
과 같은 오류를 표시합니다.사파리에서 javascript를 사용하여 사운드 재생
function EvalSound(soundobj) {
var thissound= eval("document."+soundobj);
thissound.Play();
}
<embed src="namaste_london01(www.songs.pk).mp3" autostart=false width=0 height=0 name="sound1"
enablejavascript="true">
<a href="#" onClick="EvalSound('sound1')"> Play </a>
미리 감사드립니다.
왜 'eval'을 사용하고 있습니까? 단순히'document [ 'sound1']. Play()'를 사용할 수 있습니다. – jwueller