<script type="text/javascript">
document.onfocus=function(){
var el=document.activeElement;
alert("haha");
el.style.border="2px #89c6f3 solid";
}
document.onblur=function(){
var el=document.activeElement;
alert("xixi");
el.style.border="1px #7f9db9 solid";
}
</script>此段代码放到body的最后面.
document.onfocus=function(){
var el=document.activeElement;
alert("haha");
el.style.border="2px #89c6f3 solid";
}
document.onblur=function(){
var el=document.activeElement;
alert("xixi");
el.style.border="1px #7f9db9 solid";
}
</script>此段代码放到body的最后面.
<BODY onfocus="test()" onblur="test2()">
</BODY>
<script type="text/javascript">
var test=function(){
var el=document.activeElement;
alert("haha");
el.style.border="2px #89c6f3 solid";
}
var test2=function(){
var el=document.activeElement;
alert("xixi");
el.style.border="1px #7f9db9 solid";
}
</script>
这样试试。
怎么可能,我这边测试是可以弹出haha和xixi的。
里面可以设置断点和详细的js报错信息。跟firfox的debug一样。
调试下就知道哪出错了
onfocusin 当元素将要被设置为焦点之前触发。
onfocusout 在移动焦点到其它元素之后立即触发于当前拥有焦点的元素上触发。
这个我是要实现遍历input,textarea,select,radio,在所有这些控件获得,失去焦点时: 改变他的边框样式.
但是我发现获得失去焦点失效!
而是通过修改struts2的template来改变它的效果.
用到了jquery的插件.