第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

firefox和ie下功能掛掉,chrome正常,應(yīng)該怎么修改代碼

firefox和ie下功能掛掉,chrome正常,應(yīng)該怎么修改代碼

qq_sU_4 2017-04-05 09:23:50
<!DOCTYPE?html> <html?lang="en"> <head> <meta?charset="UTF-8"> <title>Title</title> <script?src="jquery.min.js"></script> <style> .commentBox{ width:700px; margin:0?auto; position:relative; } .commentBox?.textArea{ width:100%; min-height:?100px; border:1px?solid?#ddd; padding:5px; line-height:20px; word-break:?break-all; } .commentBox?.textArea?img{ width:24px; height:?24px; vertical-align:?bottom; } .faceIcon{ margin:10px; display:?block; width:24px; height:?24px; background:?url("頭像.png")?no-repeat; background-size:?100%; } .commentBox?.faceBox{ position:absolute; width:410px; height:250px; padding:10px?5px; border:1px?solid?#ddd; display:?none; background-color:?#fff; } .commentBox?.faceBox?img{ width:24px; height:24px; } </style> </head> <body> <div?class="commentBox"> <div?class="textArea"?id="editor"?contenteditable="true"></div> <span?class="faceIcon">點擊添加表情</span> <div?class="faceBox"></div> </div> <script> var?editorX=document.getElementById("editor"); $(function(){ for(var?i=0;i<120;i++){ var?imgNum=""; if(i<10){ imgNum="00"+i; }else?if(i>=10&&i<100){ imgNum="0"+i; }else{ imgNum=i; } $('<img>').attr('src','face/f_static_'+imgNum+'.png').appendTo($(".faceBox")); } $(".faceIcon").on("click",function(){ $(this).parent().find(".faceBox").toggle(); }); $(".faceBox").on("click","img",function(){ var?emoji=$(this).attr("src"); $(".textArea").focus(); var?source='<img?src="'+emoji+'">' insertContent(source); $(this).parent().hide(); }); editorX.onblur=function(){ saveRange(); }; //保存光標(biāo)位置 function?saveRange()?{ var?selection?=?window.getSelection???window.getSelection()?:?document.selection; if?(!selection.rangeCount)?return; var?range?=?selection.createRange???selection.createRange()?:?selection.getRangeAt(0); window._range?=?range; } //插入內(nèi)容 function?insertContent(str)?{ var?selection,?range?=?window._range; if?(!window.getSelection)?{ range.pasteHTML(str); range.collapse(false); range.select(); }?else?{ selection?=?window.getSelection???window.getSelection()?:?document.selection; range.collapse(false); var?hasR?=?range.createContextualFragment(str); var?hasR_lastChild?=?hasR.lastChild; while?(hasR_lastChild?&&?hasR_lastChild.nodeName.toLowerCase()?==?"br"?&&?hasR_lastChild.previousSibling?&&?hasR_lastChild.previousSibling.nodeName.toLowerCase()?==?"br")?{ var?e?=?hasR_lastChild; hasR_lastChild?=?hasR_lastChild.previousSibling; hasR.removeChild(e); } range.insertNode(hasR); if?(hasR_lastChild)?{ range.setEndAfter(hasR_lastChild); range.setStartAfter(hasR_lastChild); } selection.removeAllRanges(); selection.addRange(range); } }; }) </script> </body> </html>
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 1694 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號