复制到剪切板 - 兼容 ie, firefox, chrome & flash10 flash部署到服务器上才可以,不能直接打开页面
- <script>
- $(function(){
- $('.copy').mouseenter(function() {
- ZeroClipboard.setMoviePath("/statics/js/ZeroClipboard.swf");
- var id = $(this).attr('id'), dom = $(this).get(0);
- var clip = new ZeroClipboard.Client(dom);
- clip.setHandCursor(true); //设置鼠标手型
- clip.setText('http://www.test.com/index/'+id+'.html'); //复制的文本
- //复制成功:
- clip.addEventListener( "complete", function(){
- alert("复制成功!");
- });
- });
- });
- </script>
防止复制,剪切,粘贴
- <body oncopy ="return false " oncut ="return false " onpaste = " return false ">
4、禁止查看源码
- <body oncontextmenu="return false"></body>
19、打印
- <input type=button value='打印' onClick="window.print();">
- <script type="text/javascript">
- <!--
- function prePrint()
- {
- if (window.print) window.print();
- else if (VBS) printIt();
- else alert('This script does not work in your browser');
- }
- -->
- </script>
- </head>
- <body onload="javascript:prePrint();" style="background-color:#FFFFFF;">
<body oncontextmenu="window.event.returnValue=false">
或者:<body oncontextmenu="self.event.returnValue=false">
或者:<body oncontextmenu="return false">
文本框里禁止自动完成功能,不再出现window自带的提示功能
<input type="text" name="T1" size="20" autocomplete="off">
无关闭按钮IE
window.open("aa.htm", "meizz", "fullscreen=7");
ENTER键可以让光标移到下一个输入框
<input onkeydown="if(event.keyCode==13)event.keyCode=9">
文本框的默认值
<input type=text value="123" onChange="alert(this.defaultValue)">
自动全选
<input type=text name=text1 value="123" onfocus="this.select()">