<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>seclectmusic.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
//定义更改背景音乐的函数
function my_sound(obj)
{
alert("1");
if(obj.options[obj.selectedIndex].value=='1'){
alert("2");
var n=document.getElementById("f");
n.src="1.pm3";
n.autoplay=true;
n.play();
}
if(obj.options[obj.selectedIndex].value=='2'){
alert("3");
var m = document.getElementsByName("s");
m.src = "2.mp3";
m.play();
}
if(obj.options[obj.selectedIndex].value=='0'){
var m = document.getElementsByName("music2");
m.src = "";
m.stop();
}
}
</script>
</head>
<body >
<!--<embed src="1.mp3" type="application/x-mplayer2" autostart="true" playcount="true" loop="true" height="0" width="0"> -->
<embed id="f" src="1.mp3" loop="-1" autoplay="false" hidden="true" type="application/x-mplayer2">
<embed id="s" src="2.mp3" loop="-1" autostart="false" autoplay="false" hidden="true" type="application/x-mplayer2">
<form >
<select onchange="my_sound(this)" >
<!-- <option value="0" selected="selected">------无------</option> -->
<option value="1" selected="selected">曲目1</option>
<option value="2" >曲目2</option>
</select>
</form>
</body>
</html>
<html>
<head>
<title>seclectmusic.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
//定义更改背景音乐的函数
function my_sound(obj)
{
alert("1");
if(obj.options[obj.selectedIndex].value=='1'){
alert("2");
var n=document.getElementById("f");
n.src="1.pm3";
n.autoplay=true;
n.play();
}
if(obj.options[obj.selectedIndex].value=='2'){
alert("3");
var m = document.getElementsByName("s");
m.src = "2.mp3";
m.play();
}
if(obj.options[obj.selectedIndex].value=='0'){
var m = document.getElementsByName("music2");
m.src = "";
m.stop();
}
}
</script>
</head>
<body >
<!--<embed src="1.mp3" type="application/x-mplayer2" autostart="true" playcount="true" loop="true" height="0" width="0"> -->
<embed id="f" src="1.mp3" loop="-1" autoplay="false" hidden="true" type="application/x-mplayer2">
<embed id="s" src="2.mp3" loop="-1" autostart="false" autoplay="false" hidden="true" type="application/x-mplayer2">
<form >
<select onchange="my_sound(this)" >
<!-- <option value="0" selected="selected">------无------</option> -->
<option value="1" selected="selected">曲目1</option>
<option value="2" >曲目2</option>
</select>
</form>
</body>
</html>
解决方案 »
- 当checkbox选中时,按钮才能点击。checkbox没有被选中时,按钮为不能点击的状态
- 有2位数字,如果第一位输入输入0,后面一位只能输入1-9,如果第一位输入1第二位只能输入1-2。的正则表达式?
- 如何检测字符串里有"\n",请高手进!
- 怎么样通过JAVASCRIPT来生成链接
- 在body设置禁用了右键,如何用javaScript恢复可以使用右键?
- 精彩图片上传空间分享
- 如何用JS在本地机上生成一个文本文件并将TEXTAREA的内容写入里面,谢谢
- 如何使新开窗口的关闭按钮失效??
- 四层效果叠加的实现问题,有图,诚恳求教
- jqGrid的导出EXCEL功能
- 关于JS获取request中LIST对象的值 迭代给jsp中的ul li
- 请教ajax加载百度分享问题
=>
var m = document.getElementById("s");
都试过 都是想获取<embed></embed> 还是没反应