zoukankan      html  css  js  c++  java
  • js高级编程笔记2

    1.document.open -- 打开已经载入的文档
    var win = window.open("about:blank","dreamdu");
    win.document.open();
    win.document.write("welcome to dreamdu!");
    win.document.close();
    2.document.getSelection()获取页面上选中的文字:
    <script type="text/javascript">
    var isNav = (navigator.appName.indexOf("Netscape") !=-1);
    function showSelection(){
    if(window.getSelection) {
    alert(window.getSelection());
    }
    else if (document.getSelection) {
    alert(document.getSelection());

    }
    else if (document.selection) {
    alert(document.selection.createRange().text);
    }
    }
    if (isNav) {
    document.captureEvents(Event.MOUSEUP);
    }
    document.onmouseup = showSelection;
    </script>
    </head>
    <body>aaaaaaaaaaaaaaaa1111111111111
    <textarea name="selectedText" rows = 3 cols=40 wrap="virtusl">
    </textarea>
    </body>

    ff中:

    function getTextFieldSelection(e) {
    if (e.selectionStart != undefined && e.selectionEnd != undefined) {
    var start = e.selectionStart;
    var end = e.selectionEnd;
    return e.value.substring(start, end);
    }
    else return "";
    }

    3.文本对象的 select()选定文本对象的文本

    4.一般的对象在表单域中提交信息的长度不能超过256个字节,超过过时用文本区域对象type="textarea"




  • 相关阅读:
    EasyUI--Alert()
    asp.net 页面之间传值的几种方式
    c# 的类成员
    c# protected public private internal
    C#中的多态性
    c# 静态成员和实例成员的区别
    js确认框confirm()用法实例详解
    JS中的switch case
    分分钟用上C#中的委托和事件
    Asp.net MVC中关于@Html标签Label、Editor使用
  • 原文地址:https://www.cnblogs.com/ylemzhang/p/1911337.html
Copyright © 2011-2022 走看看