<BODY oncontextmenu="return false" onselectstart="return false"
ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty() onselect=document.selection.empty()>
-----------------------------------------------
防止复制的js
-----------------------------------------------
<SCRIPT language=JavaScript1.2>
function disableselect(e){
return false}
function reEnable(){return true
}
file://if IE4+
document.onselectstart=new Function ("return false")
file://if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</SCRIPT>
<SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) {//reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidthdocument.MM_pgH=innerHeightonresize=MM_reloadPage}}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload()
}
MM_reloadPage(true)
//-->
</SCRIPT>
-------------------------------------------------------
防止下载的js
-------------------------------------------------------
<noscript><iframe src=""></iframe></noscript>
--------------------------------------------------------
下面是防止右键的js:
--------------------------------------------------------
<script language="JavaScript">
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP)
function nocontextmenu() {
event.cancelBubble = true
event.returnValue = false
return false
}
function norightclick(e) {
if (window.Event){
if (e.which == 2 || e.which == 3)
return false
}else{
if (event.button == 2 || event.button == 3){
event.cancelBubble = true
event.returnValue = false
return false
}
}
}
document.oncontextmenu = nocontextmenu// for IE5+
document.onmousedown = norightclick// for all others
//-->
</script>
设置CSS中属性使表单元素方法有:
1、使用readonly="readonly"属性,让输入框变为只读。
代码示例一:
<input type="text" readonly="readonly" value="代码示例一">2、使用disabled="disabled"属性,输入框变为灰色背景只读,但无法再提交被禁用的元素值。
代码示例二:
<input type="text" disabled="disabled" value="代码示例二">3、使用onfocus="this.blur()"属性,和使用readonly效果一样,但是禁止选中。
代码示例三:
<input type="text" onfocus="this.blur()" value="代码示例三">三个示例的效果图:
<style>.fileout{
width:220px
height:24px
background:#F00
}
.file{
filter:alpha(opacity=10)
}
</style>
<div class="fileout">
<input type="file" class="file" />
</div> FILE这个用透明度隐藏掉。然后外面加个层,直接把FILE的背景图放上就好。貌似火狐需要另外个透明度写法。具体你自己找找吧透明度改成0