<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>js控制背景音乐bgsound---www.jb200.com</title>
</head>
<body>
<script type="text/
javascript">
var bg_sound=document.createelement_x("bgsound"); //创建背景音乐
bg_sound.id="i_bg"//设置id属性
document.body.appendchild(bg_sound);//body中添加背景音乐
//bg_sound.src="tmp3.mp3";
i_bg.src="tmp3.mp3";//设置一个背景音乐文件
//也可以用write
function bg_stop(){
i_bg.src="";
}
function bg_start(){
i_bg.src="tmp3.mp3";
}
</script>
<span ><a onclick="javascript:bg_stop();" href="javascript:void(0);">背景音乐停止</a></span>
<span ><a onclick="javascript:bg_start();" href="javascript:void(0);">背景音乐开始</a></span>
</body>
</html>