|
查看: 1439|回复: 3
|
需要高人指点!网站声音开关在ff无法运行。
[复制链接]
|
|
|
在IE测试没问题,但是在ff完全没声音出来
请问问题出在哪里?
尝试过几个版本的,但是总有一个browser会无法运行。
各位高人请指点,多谢。
由于强制要在iphone也可以运行,所以任何需要flash 来support 的都不行~~
<head>
<bgsound id="PlayMusic">
<script type="text/javascript">
<!--
PlayMusic.src="robot2.mp3";
function OnOff() {
PlayMusic.src="";
OnOffButton.value="Stop";
}
function OnPlay() {
PlayMusic.src="robot2.mp3";
OnPlayButton.value="Play";
}
// -->
</script>
</head>
<input type="button" name="OnOffButton" value="Stop">
<input type="button" name="OnPlayButton" value="Play"> |
|
|
|
|
|
|
|
|
|
|
发表于 28-6-2010 03:31 PM
|
显示全部楼层
也许是因为你没有放onclick event在button吧。。- <head>
- <bgsound id="PlayMusic">
- <script type="text/javascript">
- var PlayMusic = document.getElementById('PlayMusic');
- PlayMusic .src="robot2.mp3";
- function OnOff() {
- PlayMusic.src="";
- }
- function OnPlay() {
- PlayMusic.src="robot2.mp3";
- }
- </script>
- </head>
- <input type="button" name="OnOffButton" value="Stop" onclick="OnOff()">
- <input type="button" name="OnPlayButton" value="Play" onclick="OnPlay()">
复制代码 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 30-6-2010 06:42 PM
|
显示全部楼层
也许是因为你没有放onclick event在button吧。。
ahcheong 发表于 28-6-2010 03:31 PM 
这个只能在IE跑到啊 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 30-6-2010 06:47 PM
|
显示全部楼层
我刚找了一个script ,目前在IE和ff都没问题的了
但是发现在safar没办法运行和music没办法loop。不懂有谁有遇过类似的问题???
- <head>
- <script>
- function EvalSound(soundobj) {
- var thissound=document.getElementById(soundobj);
- thissound.Play();
- }
- function StopSound(soundobj) {
- var thissound=document.getElementById(soundobj);
- thissound.Stop();
- }
- </script>
- <embed src="success.wav" autostart=true width=0 height=0 id="sound1"
- enablejavascript="true" loop="true">
-
- </head>
- <body>
- <audio src="success.wav" autoplay="false" loop="true" id="sound1"></audio>
- <form>
- <input type="button" value="Play Sound" onClick="EvalSound('sound1')">
- <input type="button" value="Stop Sound" onClick="StopSound('sound1')">
- </form>
- </body>
复制代码 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|