javaScript实现背景音乐与播放声音
研究了半天,不过貌似还是只能在IE上实现,其他浏览器不支持EMBED 标签
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用javascript制作超链接的背景音效</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function controlSound(action)
{
var i; method = "";
var sndObj = document.getElementById("music");
if (sndObj != null)
{
if (navigator.appName == 'Netscape')
method = "play";
else
{
if (window.MM_WMP == null)
{
window.MM_WMP = false;
for(i in sndObj)
{
if (i == "ActiveMovie")
{
window.MM_WMP = true;
//alert("1");
break;
}
}
}
if (window.MM_WMP)
method = "play";
else if (sndObj.FileName)
method = "run";
}
}
if (method)
{
if(action=="stop")
method="stop";
alert(method);
eval("document.hidden_player"+"."+method+"()");
}
}
//-->
</script>
</head>
<body>
<a href="#" onMouseOver="controlSound('play','document.ailisi','2.mp3')"
onmouseout="controlSound('stop','document.ailisi','2.mp3')"
>背景音乐 鼠标移入播放 移出停
</a> <br>
<button onclick="controlSound('play')">播</button>
<button onclick="controlSound('stop')">停</button>
<!--src是音频的地址, hidden属性为隐藏-->
<EMBED NAME='hidden_player' SRC='1.wma
相关文档:
//1.类
function Test(id)
{
this.id=id;
this.method=function()
{
//代码
};
}
......
注册很长时间号了,刚开通博客,拿出一个自己写的javascript右键菜单,兼容IE,firefox浏览器
这是css代码
body{
font-size:12px;
}
.contextMenu{
filter:alpha(opacity=80);
opacity:0.8;
border:1px #0033FF solid;
background-color:#0099CC;
cursor:pointer;
width:120px;
position:absolute;
top: ......
介绍怎样解决JavaScript页面刷新与弹出窗口的问题。
1.无提示刷新网页
大家有没有发现,有些网页,刷新的时候,会弹出一个提示窗口,点“确定”才会刷新。
而有的页面不会提示,不弹出提示窗口,直接就刷新了.
如果页面没有form,则不会弹出提示窗口。如果页面有form表单,
a)< fo ......
1:js 字符串长度限制、判断字符长度 、js限制输入、限制不能输入、textarea 长度限制
2.:js判断汉字、判断是否汉字 、只能输入汉字
3:js判断是否输入英文、只能输入英文
4:js只能输入数字,判断数字、验证数字、检测数字、判断是否为数字、只能输入数字
5:只能输入英文字符和数字
6: js email验证 、js 判断 ......