XHTML教程:如何去除鏈接虛線框?_XHTML教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
局部控制
<a href="link1.htm" onfocus="this.blur()">link1</a>
<a href="link1.htm" onfocus="this.close()">link1</a>
<a href="link1.htm" hidefocus="true">link1</a>
<a href="link1.htm" hidefocus="hidefocus">link1</a>
全局控制
CSS實現(xiàn)
a{blr:expression(this.onFocus=this.close());} /* 只支持IE,過多使用效率低 */
a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,過多使用效率低 */
a:focus { -moz-outline-style: none; } /* IE不支持 */
HTC實現(xiàn) IE支持,頁面載完才有效果
把下面這段代碼存為.htc為擴展名的文件
調(diào)用 a {behavior:url(htc文件所在路徑地址)}
JS遍歷實現(xiàn)
JS封裝為函數(shù)
當(dāng)前是添加一個hidefocus的屬性,注釋掉的句子是添加onfucus=this.blur();
然后調(diào)用fHideFocus("A"),即可把a的虛線框去掉
通過傳遞不同的參數(shù),可以去掉更多的虛線框,比如"BUTTON"可以去掉button的
但要記住參數(shù)要用大寫字母
A. map area內(nèi)鏈接如何消除鏈接虛線?
這是一個觀念上的錯誤,其實應(yīng)該在所在map的圖片上加以控制,而不是在area內(nèi),參考傳統(tǒng)辦法
B. 關(guān)于onFocus
onFocus是設(shè)置鼠標(biāo)焦點事件的東西,這個可以用,也可以不用,不過為了讓更多的瀏覽器識別的話,建議采用Border=0 這個才是去除虛線框的要害所在(在網(wǎng)上看到有的人用onFocus="this.blur()"來消除虛線框,但在本地測試時,僅僅用這一句是不能消除的) ? 一葉千鳥
<a href="link1.htm" onfocus="this.blur()">link1</a>
<a href="link1.htm" onfocus="this.close()">link1</a>
<a href="link1.htm" hidefocus="true">link1</a>
<a href="link1.htm" hidefocus="hidefocus">link1</a>
全局控制
CSS實現(xiàn)
a{blr:expression(this.onFocus=this.close());} /* 只支持IE,過多使用效率低 */
a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,過多使用效率低 */
a:focus { -moz-outline-style: none; } /* IE不支持 */
HTC實現(xiàn) IE支持,頁面載完才有效果
把下面這段代碼存為.htc為擴展名的文件
示例代碼 [www.wf0088.com]
<public:attach event="onfocus" onevent="hscfsy()"/>
<script language="javascript">
function hscfsy(){
this.blur();
}
</script>
<script language="javascript">
function hscfsy(){
this.blur();
}
</script>
調(diào)用 a {behavior:url(htc文件所在路徑地址)}
JS遍歷實現(xiàn)
示例代碼 [www.wf0088.com]
window.onload=function()
{
for(var ii=0; ii<document.links.length; ii )
document.links$[$ii$]$.onfocus=function(){this.blur()}
}
{
for(var ii=0; ii<document.links.length; ii )
document.links$[$ii$]$.onfocus=function(){this.blur()}
}
JS封裝為函數(shù)
示例代碼 [www.wf0088.com]
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();};
}
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();};
}
當(dāng)前是添加一個hidefocus的屬性,注釋掉的句子是添加onfucus=this.blur();
然后調(diào)用fHideFocus("A"),即可把a的虛線框去掉
通過傳遞不同的參數(shù),可以去掉更多的虛線框,比如"BUTTON"可以去掉button的
但要記住參數(shù)要用大寫字母
A. map area內(nèi)鏈接如何消除鏈接虛線?
這是一個觀念上的錯誤,其實應(yīng)該在所在map的圖片上加以控制,而不是在area內(nèi),參考傳統(tǒng)辦法
B. 關(guān)于onFocus
示例代碼 [www.wf0088.com]
<a href=“http://blog.csdn.net/alonesword/“ onFocus="this.blur()">
<Img Src="Example.jpg" Border=0>
</a>
<Img Src="Example.jpg" Border=0>
</a>
onFocus是設(shè)置鼠標(biāo)焦點事件的東西,這個可以用,也可以不用,不過為了讓更多的瀏覽器識別的話,建議采用Border=0 這個才是去除虛線框的要害所在(在網(wǎng)上看到有的人用onFocus="this.blur()"來消除虛線框,但在本地測試時,僅僅用這一句是不能消除的) ? 一葉千鳥
相關(guān)XHTML教程:
- HTML5 INPUT placeholder及兼容性處理
- HTML表單里的Label標(biāo)簽
- 淺析HTML與javascript中常用編碼
- CSS網(wǎng)頁布局中必須要了解的幾個XHTML標(biāo)簽
- title和alt 標(biāo)簽介紹及其異同
- 淺析HTML標(biāo)簽strong和em的區(qū)別
- 說說XHTML中的alt屬性和title屬性
- Semantics語義是Html Xhtml是否真正符合標(biāo)準(zhǔn)的重要部分
- 九個W3C XHTML1.0及CSS標(biāo)準(zhǔn)認(rèn)證需要注意的問題
- 請注意頁面head區(qū)域的編碼是不是規(guī)范
- HTML validate - 驗證HTML代碼穿越多重瀏覽器標(biāo)準(zhǔn)
- XHTML具有語義的標(biāo)簽:有關(guān)H1位置的討論
- 相關(guān)鏈接:
- 教程說明:
XHTML教程-XHTML教程:如何去除鏈接虛線框?。