问题描述
我很难让这段代码工作...... onMouseOver和
onMouseOut事件似乎不会在IE或Mozilla中解雇.....谢谢
提前获得任何帮助...
var imgf = document.createElement(" img");
imgf .src =" ../ files / img.gif";
imgf.style.cursor =" pointer";
imgf.style.border =" 1px纯蓝色" ;;
imgf.title ="日期选择器" ;;
//以下根本不起作用......
imgf.onMouseOver =" this.style.background =''blue'';" ;;
imgf.onMouseOver =" this.style。 background ='''';" ;;
再次感谢!
Michael
I''m having a hard time getting this code to work...the onMouseOver and
onMouseOut events don''t seem to be firing in IE or Mozilla.....thanks
in advance for any assistance...
var imgf = document.createElement("img");
imgf.src = "../files/img.gif";
imgf.style.cursor = "pointer";
imgf.style.border = "1px solid blue";
imgf.title = "Date selector";
// below is not working at all......
imgf.onMouseOver = "this.style.background=''blue'';";
imgf.onMouseOver = "this.style.background='''';";
Thanks again!
Michael
推荐答案
imgf.onmouseover = function(){this.style.backgroundColor =''blue'';}
Mick
imgf.onmouseover = function(){this.style.backgroundColor=''blue'';}
Mick
imgf.onmouseover = function(){this.style.backgroundColor =''blue' ';}
imgf.onmouseover = function(){this.style.backgroundColor=''blue'';}
哎呀,为图像指定背景颜色毫无意义
imgf.onmouseover = function(){this。 parentNode.style.backgroundColor =''blue'';}
Mick
Oops, makes no sense to assign a background colour to an image
imgf.onmouseover = function(){this.parentNode.style.backgroundColor='' blue'';}
Mick
这篇关于将事件添加到新创建的控件问题...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!