有些东西,不要会写。只要会粘!
<body onselectstart="return false"> 取消选取、防止复制
<noscript><iframe src=*.html></iframe></noscript> 网页将不能被另存为
<link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标
<link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标
模仿IE
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" VALUE="Close"></OBJECT>
<input type=button value=最小化 onclick=hh1.Click()>
<input type=button value=最大化 onclick=hh2.Click()>
<input type=button value=关闭 onclick=hh3.Click()>
//前进后退的按钮
<a href ="" onClick="parent.history.back(); return false;"
onMouseOver="self.status='后退' ;return true;">
[back]</a>
<a href ="" onClick="parent.history.forward(); return false;"
onMouseOver="self.status='前进'; return true;">
[next]</a>
HTML和服务器端的控件都可以用
onpaste="return false" 不准粘贴
oncopy="return false;" oncut="return false;" 防止复制
<input style="ime-mode:disabled"> 关闭输入法
//禁止鼠标右键
<script language=JavaScript>
<!--
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>
弹出窗口
<a href="#" onclick='Javascript:window.open("test.aspx","newwin","height=200,width=400,top=500,left=500 ,status=yes,toolbar=no,menubar=no,location=no")'>无地址栏的窗口</a>
禁止输入特殊字符正则表达试:
^(?:[\u4e00-\u9fa5]*\w*\s*)+$
过虑非法字符的函数:
public string CheckStr(string str)
{
str = str.Replace("<", "<");
str = str.Replace(">", ">");
str = str.Replace("'", "''");
str = str.Replace(" ", " ");
str = str.Replace("\n", "<br/>");
str = str.Replace("\r\n", "<br/>");
str = str.Trim();
return str;
}