通過腳本控制指定內(nèi)容不能被選擇
更新時(shí)間:2007年02月07日 00:00:00 作者:
其它例子:
<script type="text/javascript">
disableSelection(document.body) //disable text selection on entire body of page
</script>
<script type="text/javascript">
var somediv=document.getElementById("mydiv")
disableSelection(somediv) //disable text selection within DIV with id="mydiv"
</script>
<script type="text/javascript">
var alltables=document.getElementsByTagName("table")
for (var i=0; i<alltables.length; i++)
disableSelection(alltables[i]) //disable text selection within all tables on the page
</script>
[Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]
復(fù)制代碼 代碼如下:
<script type="text/javascript">
disableSelection(document.body) //disable text selection on entire body of page
</script>
<script type="text/javascript">
var somediv=document.getElementById("mydiv")
disableSelection(somediv) //disable text selection within DIV with id="mydiv"
</script>
<script type="text/javascript">
var alltables=document.getElementsByTagName("table")
for (var i=0; i<alltables.length; i++)
disableSelection(alltables[i]) //disable text selection within all tables on the page
</script>
[Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]
相關(guān)文章
firefox(火狐)和ie瀏覽器禁止右鍵和禁止復(fù)制的代碼
多瀏覽器兼容的禁止右鍵和禁止復(fù)制的代碼。2009-09-09
javascript四個(gè)方向無間隙滾動(dòng)合集(多瀏覽器IE,firefox兼容)
比較有想法的四個(gè)方向,多瀏覽器兼容的無縫隙滾動(dòng)效果腳本2008-05-05
javascript簡(jiǎn)易動(dòng)畫類(div漸變)
javascript簡(jiǎn)易動(dòng)畫類 寬度漸變 高度漸變 透明度漸變 邊框漸變 綜合漸變2010-07-07

