动态设置onmousein不作用 onmousein??你的意思是需要触发onmousemove事件?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 创建带参事件的时候 要有一个匿名函数img.setAttribute("onmouseover",function(){menuMouseOut(img.id)}); 另外一个问题没研究过。。 换种方式img.onmouseout = function(){ menuMouseOut(this.id);};img.onmouseover = function(){ menuMouseIn(this.id);}; 以上几种方式都不作用啊.再把我的具体环境说下:<body onload = "onpageload()">//============================/* JS.JS文件*/function onpageload(){ setImgEvent();}function setImgEvent(){//在这里动态添加标签的两个鼠标事件,但是不起作用..} 是不是这个效果??<style type="text/css">.xx{ border:3px solid #FF6600;}.oo{boder:0px}</style><script>function onpageload(){setImgEvent()}function setImgEvent() {var img=document.getElementById("img")img.attachEvent("onmouseover", function(){show("xx")})img.attachEvent("onmouseout", function(){hidde("oo")})}function show(e){document.getElementById("img").className=e}function hidde(e){document.getElementById("img").className=e}</script><body onload="onpageload()"><img id="img" src="http://img1.qq.com/news/pics/13403/13403344.jpg" width="310" height="210"> </body> 事件源丢失!如果是已填加成功!会报语法错误的!没有onmousein事件:onmouseout,onmouseover var Img = document.getElementById"img_1"); 呵呵var Img = document.getElementById("img_1"); 谢谢各位,结贴了.function initMenuEvent(){ var arrayImg = document.getElementsByTagName("img"); var img= null; for (var i=0;i<arrayImg.length;i++) { img = arrayImg[i]; if (img.id.substr(0,4) == "imgm") { img.onmouseout = function(){menuMouseOut(this.id);}; img.onmouseover = function(){menuMouseOver(this.id);}; } } }//以上语句成功,onmousein 事件不存在.但是当把this.id换成 img.id,运行却抱错:错误的参数.不知道为什么 浏览器为什么要限制Ajax跨域? 请问如何异步加载多个div? 求一正則,只能是空和數字 拖动层问题 求JS,求助各位大侠指教 (100分)弹出层的问题. 关于js/jquery url传参的问题 框架内,一个页面如何调用另一个页面的js函数 各位我想实现这样一个功能请指点 关于DOM的奇怪现象!!! 怎么做这种javascript控件啊,急!! 怎么换作用vbscript 这句话就显示不出来了
img.setAttribute("onmouseover",function(){menuMouseOut(img.id)});
另外一个问题没研究过。。
menuMouseOut(this.id);
};
img.onmouseover = function(){
menuMouseIn(this.id);
};
<body onload = "onpageload()">
//============================
/* JS.JS文件*/function onpageload()
{
setImgEvent();
}
function setImgEvent()
{
//在这里动态添加标签的两个鼠标事件,但是不起作用..
}
<style type="text/css">
.xx{ border:3px solid #FF6600;}
.oo{boder:0px}
</style>
<script>
function onpageload(){
setImgEvent()
}function setImgEvent() {
var img=document.getElementById("img")
img.attachEvent("onmouseover", function(){show("xx")})
img.attachEvent("onmouseout", function(){hidde("oo")})
}function show(e){
document.getElementById("img").className=e
}
function hidde(e){
document.getElementById("img").className=e
}
</script>
<body onload="onpageload()">
<img id="img" src="http://img1.qq.com/news/pics/13403/13403344.jpg" width="310" height="210">
</body>
var Img = document.getElementById("img_1");
function initMenuEvent()
{
var arrayImg = document.getElementsByTagName("img");
var img= null;
for (var i=0;i<arrayImg.length;i++)
{
img = arrayImg[i];
if (img.id.substr(0,4) == "imgm")
{
img.onmouseout = function(){menuMouseOut(this.id);};
img.onmouseover = function(){menuMouseOver(this.id);};
}
}
}
//以上语句成功,onmousein 事件不存在.
但是当把this.id换成 img.id,运行却抱错:错误的参数.不知道为什么