onFocus="this.blur()",
来源:互联网 发布:nginx 别名 404 编辑:程序博客网 时间:2024/04/30 06:10
<input name="result" id="result" type="text" onFocus="this.blur();" size="20" value="">
是一个输入框,用户输入文本的框就是类似于百度的搜索框,大小是20,value=""说明初始为空
onfocuse="this.blur()"
onfocuse是聚焦的意思,当你把光标放在文本框上输入的时候,就是聚焦,但这里添加了"this.blur()",blur的作用就是去除聚焦,也就是你不能把光标放在这个文本框上,换句话说就是你不能输入文本了
----------
整个代码构成了”不能输入任何文本的文本框“
用onFocus="this.blur()"来消除链接后的焦点虚线框
局部控制
<a href="link1.htm" nfocus="this.blur()">link1</a>
<a href="link1.htm" nfocus="this.close()">link1</a>
<a href="link1.htm" hidefocus="true">link1</a>
<a href="link1.htm" hidefocus="hidefocus">link1</a>
全局控制 CSS实现
a{blr:expression(this.onFocus=this.close());} /* 只支持IE,过多使用效率低 */
a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,过多使用效率低 */
a:focus { -moz-outline-style. none; } /* IE不支持 */
HTC实现 IE支持,页面载完才有效果
把下面这段代码存为.htc为扩展名的文件
<public:attach event="onfocus" nevent="hscfsy()"/>
<script. language="javascript">
function hscfsy(){this.blur();}
</script>
调用 a {behavior.:url(htc文件所在路径地址)}
JS遍历实现
window.onload=function()
{
for(var ii=0; ii<document.links.length; ii++)
document.links$[$ii$]$.onfocus=function(){this.blur()}
}
JS封装为函数
function fHideFocus(tName){
aTag=document.getElementsByTagName(tName);
for(i=0;i<aTag.length;i++)aTag$[$i$]$.hideFocus=true;
//for(i=0;i<aTag.length;i++)aTag$[$i$]$.onfocus=function(){this.blur();};
}
当前是添加一个hidefocus的属性,注释掉的句子是添加onfucus=this.blur();
然后调用fHideFocus("A"),即可把a的虚线框去掉
通过传递不同的参数,可以去掉更多的虚线框,比如"BUTTON"可以去掉button的
但要记住参数要用大写字母
A. map area内链接如何消除链接虚线?
这是一个观念上的错误,其实应该在所在map的图片上加以控制,而不是在area内,参考传统办法
B. 关于onFocus
<a href=“http://blog.csdn.net/alonesword/“ nFocus="this.blur()">
<Img Src="Example.jpg" Border=0>
</a>
onFocus是设置鼠标焦点事件的东西,这个可以用,也可以不用,不过为了让更多的浏览器识别的话,建议采用Border=0 这个才是去除虚线框的关键所在
(在网上看到有的人用onFocus="this.blur()"来消除虚线框,但在本地测试时,仅仅用这一句是不能消除的)
我的意见:onFocus="this.blur()",使用起来效果还挺好,跟border是没有什么关系的,一两下用也没有必要做成函数了
是一个输入框,用户输入文本的框就是类似于百度的搜索框,大小是20,value=""说明初始为空
onfocuse="this.blur()"
onfocuse是聚焦的意思,当你把光标放在文本框上输入的时候,就是聚焦,但这里添加了"this.blur()",blur的作用就是去除聚焦,也就是你不能把光标放在这个文本框上,换句话说就是你不能输入文本了
----------
整个代码构成了”不能输入任何文本的文本框“
用onFocus="this.blur()"来消除链接后的焦点虚线框
局部控制
<a href="link1.htm" nfocus="this.blur()">link1</a>
<a href="link1.htm" nfocus="this.close()">link1</a>
<a href="link1.htm" hidefocus="true">link1</a>
<a href="link1.htm" hidefocus="hidefocus">link1</a>
全局控制 CSS实现
a{blr:expression(this.onFocus=this.close());} /* 只支持IE,过多使用效率低 */
a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,过多使用效率低 */
a:focus { -moz-outline-style. none; } /* IE不支持 */
HTC实现 IE支持,页面载完才有效果
把下面这段代码存为.htc为扩展名的文件
<public:attach event="onfocus" nevent="hscfsy()"/>
<script. language="javascript">
function hscfsy(){this.blur();}
</script>
调用 a {behavior.:url(htc文件所在路径地址)}
JS遍历实现
window.onload=function()
{
for(var ii=0; ii<document.links.length; ii++)
document.links$[$ii$]$.onfocus=function(){this.blur()}
}
JS封装为函数
function fHideFocus(tName){
aTag=document.getElementsByTagName(tName);
for(i=0;i<aTag.length;i++)aTag$[$i$]$.hideFocus=true;
//for(i=0;i<aTag.length;i++)aTag$[$i$]$.onfocus=function(){this.blur();};
}
当前是添加一个hidefocus的属性,注释掉的句子是添加onfucus=this.blur();
然后调用fHideFocus("A"),即可把a的虚线框去掉
通过传递不同的参数,可以去掉更多的虚线框,比如"BUTTON"可以去掉button的
但要记住参数要用大写字母
A. map area内链接如何消除链接虚线?
这是一个观念上的错误,其实应该在所在map的图片上加以控制,而不是在area内,参考传统办法
B. 关于onFocus
<a href=“http://blog.csdn.net/alonesword/“ nFocus="this.blur()">
<Img Src="Example.jpg" Border=0>
</a>
onFocus是设置鼠标焦点事件的东西,这个可以用,也可以不用,不过为了让更多的浏览器识别的话,建议采用Border=0 这个才是去除虚线框的关键所在
(在网上看到有的人用onFocus="this.blur()"来消除虚线框,但在本地测试时,仅仅用这一句是不能消除的)
我的意见:onFocus="this.blur()",使用起来效果还挺好,跟border是没有什么关系的,一两下用也没有必要做成函数了
- onFocus="this.blur()",
- blr:expression(this.onFocus=this.blur())
- outline:none || hidefocus="true" || onfocus="this.blur();"
- 批量消除超链接虚线框 onfocus=”this.blur()”
- 盲人站长深恶痛绝的onfocus=”this.blur()”
- onfocus="this.blur()" 文本框不可点击输入
- 关于使用onfocus=”this.blur()”的利与弊
- 盲人站长深恶痛绝的onfocus=”this.blur()”
- onfocus="this.value=''"
- onfocus="this.select();"的使用
- onfocus事件,onblur事件;Focus()方法,Blur()方法
- 密码框显示placeholder提示信息 onfocus="this.type='password'"
- js学习笔记(七)onfocus事件和blur的使用
- jq获得焦点focus,失去焦点blur,change()函数,js的onfocus,onblur,onchange()方法
- blur
- blur
- blur
- html - get the id of onclick(this), onfocus(this) or whatever(this)
- mac 上搭建svn服务器
- Illegal pattern character 'Y'错误
- android-lighthoust编译错误
- AJAX弹出提示信息效果
- 一切都是需要由自己去争取的
- onFocus="this.blur()",
- Activity-android:configChanges属性
- Recurrent Problems 1.1 THE TOWER OF HANOI
- SQL Server 2005无法远程连接的解决方法
- C#.net关于生成html静态页面的问题
- Nikon Capture NX(尼康照片处理) v2.4.1中文完美破解版
- 从CEdit派生一个新类模拟Edit的ES_PASSWORD风格
- MAA
- Vmware中的网络 (host-only, bridge, nat)