您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

通过脚本控制指定内容不能被选择_典型特效

2024/3/9 16:37:56发布36次查看
通过脚本控制指定内容不能被选择_典型特效
其它例子:
<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>
<script type="text/javascript"> //more javascript from http://www.smallrain.net function disableselection(target){ if (typeof target.onselectstart!="undefined") //ie route target.onselectstart=function(){return false} else if (typeof target.style.mozuserselect!="undefined") //firefox route target.style.mozuserselect="none" else //all other route (ie: opera) target.onmousedown=function(){return false} target.style.cursor = "default" } //sample usages //disableselection(document.body) //disable text selection on entire body //disableselection(document.getelementbyid("mydiv")) //disable text selection on element with id="mydiv" </script> <div id="test" style="background:#f1f1f1;border:1px #000 dotted">这里不能选择</div> <script type="text/javascript"> var somediv=document.getelementbyid("test") disableselection(somediv) //disable text selection within div with id="mydiv" </script>
以上就是通过脚本控制指定内容不能被选择_典型特效的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product