2
sound onclickイベントを再生したいです。私はFirefoxや他のブラウザでサウンドを再生できるが、サファリでは再生できないコードがある。 以下はそのコードです。 Safariは私に"thissound.Play" [undefined ] is not a function
のようなエラーを与えます。Safariで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