如何在javascript代码中调用javascript onmouseout
事件?在javascript中调用javascript onmouseout事件
即:
var div=document.getElementById('new');
if(div.mouseout)
document.getElementById('new').style.visibility='hidden';
感谢。
如何在javascript代码中调用javascript onmouseout
事件?在javascript中调用javascript onmouseout事件
即:
var div=document.getElementById('new');
if(div.mouseout)
document.getElementById('new').style.visibility='hidden';
感谢。
我想你想:
var div = document.getElementById("new");
div.onmouseout = function (e)
{
this.style.visibility = "hidden";
}
window.onload = function(){
var div=document.getElementById('new');
div.onmouseout = function(){
this.style.visibility='hidden';
};
};
您可以使用this
关键字指定当前元素,无需使用document.getElementById
再次读取该元素。
谢谢.....................我现在明白了。 – Hulk 2010-02-08 12:39:56
var div = document.getElementById("new");
div.mouseout = function()
{
this.style.display='none';
}
谢谢..................... – Hulk 2010-02-08 12:40:17
呀真的,我已经把警报的环内,但它不显示................... – Hulk 2010-02-08 11:44:47
这不是一个循环,如果您希望我们调试它(将其编辑到您的问题中),您需要向我们展示您的完整代码。 – 2010-02-08 11:52:14
我编辑了我的问题。 即在mouseout上我想设置document.getElementById('new')。style.visibility ='hidden'; – Hulk 2010-02-08 12:02:58