欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

一個(gè)符號(hào)插入器 中用到的js代碼

 更新時(shí)間:2007年09月04日 22:51:39   作者:  
/**
 * @author tin555
 */
function setHTML(html) {
    ContentEdit.value = html;
        eWebEditor.document.designMode="On";
        eWebEditor.document.open();
        eWebEditor.document.write(html);
        eWebEditor.document.body.contentEditable="true";
        eWebEditor.document.execCommand("2D-Position",true,true);
        eWebEditor.document.execCommand("MultipleSelection", true, true);
        eWebEditor.document.execCommand("LiveResize", true, true);
        eWebEditor.document.close();
    eWebEditor.document.body.onpaste = onPaste ;
    //eWebEditor.document.body.onhelp = onHelp ;
    //eWebEditor.document.body.ondragend = new Function("return doDragEnd();");
    eWebEditor.document.onkeydown = new Function("return onKeyDown(eWebEditor.event);");
    //eWebEditor.document.oncontextmenu=new Function("return showContextMenu(eWebEditor.event);");
    //eWebEditor.document.onmousedown = new Function("return onMouseDown();");
    //eWebEditor.document.onmouseup = new Function("return onMouseUp();");
}

function getHTML() {
    var html;

        html = eWebEditor.document.body.innerHTML;


        if ((html.toLowerCase()=="<p>&nbsp;</p>")||(html.toLowerCase()=="<p></p>")){
            html = "";
        }

    return html;
}


function insertHTML(html) {

    eWebEditor.focus();
    if (eWebEditor.document.selection.type.toLowerCase() != "none"){
        eWebEditor.document.selection.clear() ;
    }
    eWebEditor.document.selection.createRange().pasteHTML(html) ; 
}

function appendHTML(html) {
    if (eWebEditor.document.selection.type.toLowerCase() != "none"){
        eWebEditor.document.selection.clear() ;
    }
        eWebEditor.document.body.innerHTML += html;

}


function doDragEnd(){
    var oSelection = eWebEditor.document.selection.createRange();
    var sRangeType = eWebEditor.document.selection.type;
    if (sRangeType == "Control") {
        var oControl = oSelection.item(0);
        if (oControl.tagName == "IMG"){
            oControl.src = FullPath2SetPath(oControl.src);
        }
    }
    if (sRangeType == "Text") {
        var els = eWebEditor.document.body.getElementsByTagName("IMG");
        var oRngTemp = eWebEditor.document.body.createTextRange();
        for(var i=0;i<els.length;i++){
            oRngTemp.moveToElementText(els(i));
            if (oSelection.inRange(oRngTemp)){
                els(i).src = FullPath2SetPath(els(i).src)
            }
        }
    }

    return true;
}


function onKeyDown(event){
    var n_KeyCode = event.keyCode;
        if (n_KeyCode==13){
                    return false;
        }
}

var oResizing = new Object;
function onMouseDown(){
    oResizing.El = null;
    if (eWebEditor.document.selection.type == "Control") {
        var oControlRange = eWebEditor.document.selection.createRange();
        oResizing.El = oControlRange(0);
        oResizing.W = oResizing.El.style.width;
        oResizing.H = oResizing.El.style.height;
    }

    
}

function GetClipboardHTML() {
    var oDiv = document.getElementById("eWebEditor_Temp_HTML");
    oDiv.innerHTML = "" ;
    var oTextRange = document.body.createTextRange() ;
    oTextRange.moveToElementText(oDiv) ;
    oTextRange.execCommand("Paste") ;

    var sData = oDiv.innerHTML ;
    oDiv.innerHTML = "" ;

    return sData ;
}


function cleanAndPaste( html ) {
    html = html.replace(/<\/?SPAN[^>]*>/gi, "" );
    html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
    html = html.replace(/<(\w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
    html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
    html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
    html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
    html = html.replace(/&nbsp;/, " " );

    insertHTML( html ) ;
}
function onPaste() {
        var sHTML = GetClipboardHTML() ;
            var re = /<\w[^>]* class="?MsoNormal"?/gi ;
            if ( re.test(sHTML)){
                if ( confirm("你要粘貼的內(nèi)容好象是從Word中拷出來(lái)的,是否要先清除Word格式再粘貼?") ){
                    cleanAndPaste( sHTML ) ;
                    return false ;
                }
                }
}

相關(guān)文章

  • 用cssText批量修改樣式

    用cssText批量修改樣式

    一般情況下我們用js設(shè)置元素對(duì)象的樣式會(huì)使用這樣的形式
    2009-08-08
  • Layui多選只有最后一個(gè)值的解決方法

    Layui多選只有最后一個(gè)值的解決方法

    今天小編就為大家分享一篇Layui多選只有最后一個(gè)值的解決方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-09-09
  • BootstrapTable refresh 方法使用實(shí)例簡(jiǎn)單介紹

    BootstrapTable refresh 方法使用實(shí)例簡(jiǎn)單介紹

    本文就bootstrapTable refresh 方法如何傳遞參數(shù)做簡(jiǎn)單舉例說(shuō)明,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧
    2017-02-02
  • JS+CSS實(shí)現(xiàn)過(guò)渡特效

    JS+CSS實(shí)現(xiàn)過(guò)渡特效

    這篇文章主要為大家詳細(xì)介紹了JS+CSS實(shí)現(xiàn)過(guò)渡特效,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-01-01
  • JS組件封裝之監(jiān)聽(tīng)localStorage的變化

    JS組件封裝之監(jiān)聽(tīng)localStorage的變化

    這篇文章主要介紹了JS組件封裝之監(jiān)聽(tīng)localStorage的變化,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-09-09
  • JavaScript+canvas實(shí)現(xiàn)五子棋游戲

    JavaScript+canvas實(shí)現(xiàn)五子棋游戲

    這篇文章主要為大家詳細(xì)介紹了JavaScript+canvas實(shí)現(xiàn)五子棋游戲,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-05-05
  • JavaScript設(shè)計(jì)模式之緩存代理模式原理與簡(jiǎn)單用法示例

    JavaScript設(shè)計(jì)模式之緩存代理模式原理與簡(jiǎn)單用法示例

    這篇文章主要介紹了JavaScript設(shè)計(jì)模式之緩存代理模式原理與簡(jiǎn)單用法,結(jié)合實(shí)例形式簡(jiǎn)要分析了javascript緩存代理模式的基本原理、使用方法及相關(guān)操作注意事項(xiàng),需要的朋友可以參考下
    2018-08-08
  • js判斷對(duì)象是否存在某個(gè)屬性的幾種辦法技巧

    js判斷對(duì)象是否存在某個(gè)屬性的幾種辦法技巧

    這篇文章主要給大家介紹了關(guān)于js判斷對(duì)象是否存在某個(gè)屬性的幾種辦法技巧,判斷對(duì)象中是否有某屬性的常見(jiàn)方式總結(jié),不同的場(chǎng)景要使用不同的方式,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2023-12-12
  • JS實(shí)現(xiàn)選項(xiàng)卡效果的代碼實(shí)例

    JS實(shí)現(xiàn)選項(xiàng)卡效果的代碼實(shí)例

    這篇文章主要介紹了JS選項(xiàng)卡效果,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • javascript限制用戶只能輸漢字中文的方法

    javascript限制用戶只能輸漢字中文的方法

    這篇文章主要介紹了javascript限制用戶只能輸漢字中文的方法,實(shí)例列舉了利用Unicode判斷與正則判斷兩種方法,具有一定的實(shí)用價(jià)值,需要的朋友可以參考下
    2014-11-11

最新評(píng)論