zoukankan      html  css  js  c++  java
  • DOM基本代码二

    -------------------------------

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript">
            function modifyClipboard()
            {
                var txt = clipboardData.getData("text");
                txt = txt + " 本文章来自于陈龙制作,文章来源:" + location.href;
                clipboardData.setData('text',txt);
            }
        </script>
    </head>
    <body onclose="alert('是否关闭?');return false;">
        <input type="button"value="点击"onclick="if(window.event.altKey)alert('alt键被按下')"/>
        <input type="button"value="点击"onclick="if(window.event.shiftKey)alert('shift键被按下')"/>
        <!--类似于上面的按钮判断的还有各种其他的-->
        <!--将window.event.returnValue = false 后就会阻止默认事件动作-->
        <a href="http://www.taobao.com" onclick="window.event.returnValue = false;">淘宝</a>
        <input type="button"value="分享给好友"onclick="clipboardData.setData('text', 'I find a quite well net page which is filled with AV' + location.href); alert('已经放到粘贴板上');"/>
        <table border="1">
            <tr>
                <td><label for="name">姓名:</label></td>
                <td><input type="text" id="name"/></td>
            </tr>
            <tr>
                <td><label for="pass1">手机号</label></td>
                <td><input type="text" id="pass1" onpaste="alert('禁止粘贴'); return false;"/></td>
            </tr>
            <tr>
                <td><label for="pass2">重复手机号</label></td>
                <td><input type="text" id="pass2" onpaste="alert('禁止粘贴'); return false;" /></td>
            </tr>
        </table>
        <textarea oncopy="alert('禁止复制'); return false;"onpaste="alert('禁止粘贴'); return false;">
        这里是文章的内容,复制这里吧!
        </textarea>
        
        <!--oncopy 和onpaste两种事件适合任何文本框,是在复制粘贴时对应的事情-->
        <!--不能再oncopy事件上修改粘贴板,需等待少许事件,0.1秒之类的-->
        <br/>
        <textarea oncopy="setTimeout('modifyClipboard()',100)">
            试试复制的时候要加上我的内容的方法吧!
        </textarea>
        <a href=" htmlpagedom.html" onclick="window.event.returnValue=false">htmlpagedom.html</a>
    
        
    </body>
    </html>
    What I don't dare to say is I can't!
  • 相关阅读:
    Python 文件Hash(MD5,SHA1)
    CDHtmlDialog探索Javascript与窗体交互
    C++ 实现不允许继承的类
    (一)JDBC入门及简介
    (二)JDBC 连接数据库
    2012年,总结
    canvas 时钟
    解决数据库日志文件过满的又一方法
    Windows XP 注册表修改大全
    windows2003中安装.netframework1.1
  • 原文地址:https://www.cnblogs.com/sytu/p/4085719.html
Copyright © 2011-2022 走看看