您的位置:新葡亰496net > 服务器网络 > 幻宇职业室用到js,超强推荐share

幻宇职业室用到js,超强推荐share

发布时间:2019-12-12 08:15编辑:服务器网络浏览(148)

    复制代码 代码如下:functionuser_login(卡塔尔(英语:State of Qatar){ varl createDlg("dlgLogin","客商登入",260,170卡塔尔(قطر‎ l="" insHtm oFocu(document.fmLogin.FUid卡塔尔(英语:State of Qatar) $.clickOk=function(卡塔尔(قطر‎{ document.fmLogin.btSubmit.click(卡塔尔(英语:State of Qatar) } document.fmLogin.onload=function{ location.reload } } functionuser_reg(卡塔尔国{ varl createDlg("dlgReg","顾客注册",320,260卡塔尔(قطر‎ l="" insHtm oFocu $.clickOk=function(卡塔尔国{ document.fmReg.btSubmit.click(卡塔尔 } document.fmReg.onload=function location.reload } } functionuser_logout(){ loadXml("handle_user.asp?cmd=logout",function{ location.reload } functioneditor_setLink{ varv win.focus v=window.showModalDialog("lib/input.htm","请输入超链接路线|") else v=prompt if return if win.document.execCommand else win.document.execCommand } functioneditor_insImg{ varv win.focus v=window.showModalDialog("lib/input.htm","请输入图片路线|") else v=prompt if return if/i.test return win.document.execCommand("insertimage",false,v) } functioneditor_insJs l="" l ="◇测量试验程序->>运行下边包车型地铁js" l ="

    base.js复制代码 代码如下:browser_init() functionbrowser_init(){ window.isIE=navigator.appName.indexOf==0 window.$sys={} window.$my={} String.prototype.trim=function(){returnthis.replace/g,"")} String.prototype.inc=function{s2=","};return.indexOf>-1?1:0} String.prototype.lenB=function(){returnthis.replace.length} String.prototype.leftB=function{vars;s=this.replace.replace;if{len-=3};returnthis.slice.replace.replace (s.length>len&&isOmit?"...":"")} String.prototype.getVar=function{ifreturn1;vara=this.match" str ":[^;]*"));returna==null||str==""?:a[0].replace.slice} String.prototype._slice="".slice String.prototype.slice=function{varv,b1=typeof=="number",b2=typeof=="number";if=="string"){v=eval("this._slice(" (b1?n1:this.indexOf ==-1?this.length:0)) (n2==null?"":(b2?n2:==-1?"":"," this.indexOf}else{v=eval("this._slice(n1" ")")}returnv} Array.prototype.parseInt=function(){vari,count=this.length;for{this[i]=parseInt}} Array.prototype.remove=function{vari,count=this.length;for{if{this.splice;i--;count--}}} Array.prototype.plus=function{for(vari=0;i" l ="" l ="" insHtm document.body.onmouseover=document.body.onmouseout=document.body.onmousedown=document.body.onmouseup=function{ varee e=e||event ee=e.srcElement if(e.type=="mouseover"&&(ee.tagName=="A"||ee.tagName=="INPUT"||ee.tagName=="LABEL")&&!ee.hideFocus) ee.hideFocus=true } document.body.onkeydown=function{ varee e=e||event ee=e.srcElement if(ee.tagName=="INPUT"&&e.keyCode==13&&isIE&&ee.form!=null){ if(ee.form.btSubmit!=null) ee.form.btSubmit.click() } } if(window.body_onload!=null) body_onload() } functiondrag_init(){ window.$drag={} window.startDrag=function{ $drag.obj=$ $drag.x0=$drag.obj.offsetLeft $drag.y0=$drag.obj.offsetTop $drag.sx=e.clientX $drag.sy=e.clientY if $drag.obj.setCapture() } document.onmouseup=function(){ if return if $drag.obj.releaseCapture() $drag.obj=null } document.onmousemove=function{ varx,y if return e=e||event x=Math.min(e.clientX-$drag.sx $drag.x0,document.body.scrollLeft document.body.clientWidth-$drag.obj.offsetWidth) y=Math.min(e.clientY-$drag.sy $drag.y0,document.body.scrollTop document.body.clientHeight-$drag.obj.offsetHeight) x=Math.max y=Math.max(y,document.body.scrollTop) $drag.obj.style.left=x "px" $drag.obj.style.top=y "px" } } functionthd_init(){ window.$thd={} $thd.items=[] $thd.index=0 $thd.push=function{ foo.interval=interval==null?1:interval $thd.items.push } $thd.remove=function{ $thd.items.remove } $thd.run=function(){ varol=$thd.items,i for{ if($thd.index%ol[i].interval==0||ol[i].start==null){ ol[i].start=1 ol[i]() } } $thd.index window.setTimeout } $thd.run() } function$x{ varo,x=0 op=op||document.body do{ o=o==null?$:o.parentNode if break x =o.offsetLeft }while returnx } function$y{ varo,y=0 op=op||document.body do{ o=o==null?$:o.parentNode if break if continue y =o.offsetTop-o.scrollTop }while returny } functiongetPngBg{ returndocument.all&&/.png/i.test?"filter:progid:dximagetransform.microsoft.alphaimageloader(src=" url ",sizingMethod=scale)":"background:url" } functionsetHtm if{ if op.appendChild(document.createElement op.replaceChild(document.createElement,op.tBodies[0]) } else op.innerHTML="" insHtm } functioninsHtm{ varbx=document.createElement if{ bx.innerHTML="

    怎么说呢,刚包完夜吧,应该很累了,但明天仍有力气敲打着这几个字符,看来作者还从未到此甘休啊。 废话少说,近来写了个在线的编辑器,肖似ewebeditor那样的,当然未有人家那么苍劲,可是根基效都有,何况依然宽容ie和ff的,为此作者也花了繁多武术,照旧赶紧把代码祭出来吧 demo.html: 复制代码 代码如下:

    " l ="" editor_paste } functionjsCode_run{ vardata,w data=ee.parentNode.parentNode.nextSibling.innerText w=window.open w.document.write w.document.close src=/.test w.location.reload } functionthread_save{ vardlgID="dlgThread",dlg,fm,win,btImg,bxFile if returnalert createDlg(dlgID,tid==null?"发表新贴":"改正贴子",640,480)l="" insHtm fm=document[dlgID "_fm"] win=ow oFocu dlg.clickOk=function(){ fm.btSubmit.click() } dlg.setBold=function(){ win.document.execCommand } dlg.setLink=function(){ editor_setLink } dlg.insImg=function } dlg.insJs=function } fm.onbeforeload=function(){ fm.FContent.value=editor_getVal if(fm.FContent.value==""){ alert win.focus() returnfalse } } fm.onload=function{ varurl=location.href location.href=url.replace("fclass=search","fclass=all") } } functioneditor_paste{ if w.document.selection.createRange else{ varol,i,r=w.document.createRange() w.document.execCommand("insertimage",false,"") ol=w.document.getElementsByTagName for{ if(ol[i].src==" r.setStartBefore ol[i].parentNode.insertBefore(r.createContextualFragment ol[i].parentNode.removeChild } } } } functionthread_search(){ vardlgID="dlgThreadSearch",dlg,fm,tid createDlg l="" insHtm fm=document[dlgID "_fm"] oFocu fm.onload=function{ location.href=$sys.path "index.asp?fclass=search" } }

    " str "

    字体: 宋体 黑体 楷体 仿宋 隶书 幼圆 新宋体 细明体 Arial Arial Black Arial Narrow Bradley Hand ITC Brush Script MT Century Gothic Comic Sans MS Courier Courier New MS Sans Serif Script System Times New Roman Viner Hand ITC Verdana Wide Latin Wingdings 字号: 1 2 3 4 5 6 7 颜色 加粗 倾斜 居左 居中 居右
    插入影视和图片 上传文件 插入表格 插入水平线 插入超链接

    " ol=bx.childNodes[0].tBodies[0].rows if op.appendChild(document.createElement while{ op.tBodies[0].insertBefore(ol[0],oRefer==null?null:oRefer) } } else{ op.insertBefore(bx,oRefer==null?null:oRefer) bx.outerHTML=str } btBinding } functionbtBinding{ varol,i,a,bg ol=.getElementsByTagName for{ if(ol[i].getAttribute!="button"||ol[i]幻宇职业室用到js,超强推荐share。.getAttribute continue bg=ol[i].getAttribute ol[i].removeAttribute a=ol[i].getAttribute ol[i].style.cssText="position:absolute;overflow:hidden;left:" a[0] ";top:" a[1] ";width:" a[2] ";height:" a[3] ol[i].innerHTML="" ol[i].onmouseover=function(){this.scrollTop=this.offsetHeight} ol[幻宇职业室用到js,超强推荐share。i].onmouseout=function(){this.scrollTop=0} ol[i].onmousedown=function(){this.scrollTop=this.offsetHeight*2} ol[i].onmouseup=function(){this.scrollTop=this.offsetHeight} } } functionfmBinding{ varol,i,sResult,foo ol=.getElementsByTagName for{ if continue insHtm(ol[i],"",ol[i].firstChild) ol[i].onkeydown=function{ e=e||event if returnfalse } ol[i].onsubmit=function{ varfm=this if returnfalse sResult=1 try{ foo=fm.getAttribute if=="function") sResult=foo=="string") eval(foo.replace }catch{alert} if returnfalse if{ fm.target="wForm" $sys.fmWinType=fm returntrue } loadXml{ varfoo=fm.getAttribute if=="function") foo elseif=="string") eval returnfalse } } } functionfmWinOnLoad{ varxml,str,foo,error if{ str=win.contentWindow.document.body.innerText.replace if return if){ alert return } str=str.slice } else{ if((win.contentWindow.document "").indexOf return xml=win.contentWindow.document.documentElement } error=ndv if returnalert foo=$sys.fmWinType.onload if=="function") foo elseif=="string") eval } functionfmv{ vari,f,v,l l=fm.action for{ if(!"INPUT,TEXTAREA,SELECT".inc||"submit,button".inc continue v=fm[i].value.trim() f=fm[i].getAttribute||fm[i].name if(f==""||(fm[i].type=="radio"&&!fm[i].checked)||fm[i].readOnly==true) continue if(fm[i].type=="checkbox") v=fm[i].checked?v.replace:0 l ="&" f "=" escape } if l=l.replace returnl } functioncreateXml{ varxml=newActiveXObject xml.loadXML xml.setProperty("SelectionLanguage","XPath") } else varxml=newDOMParser().parseFromString returnxml.documentElement } functiongetXmlNode{ varol if ol=node.selectNodes else{ varxpe=newXPathEvaluator(),nsr,res,ol=[],r nsr=xpe.createNSResolver(node.ownerDocument==null?node.documentElement:node.ownerDocument.documentElement) res=xpe.evaluate while{ r.text=r.textContent ol.push } } returnisAll?ol:ol[0] } functionndv{ varol,s,$0,r if returnnode.getAttribute||def ol=getXmlNode(node,unescape if return if returndef r=$0=ol.length==0?def:unescape returnr } functionloadXml{ varxh,method,ondataok xh=isIE?newActiveXObject:newXMLHttpRequest() method=url.indexOf?"GET":"POST" xh.open xh.setRequestHeader("Content-Type","application/x-www-form-urlencoded") xh.send(method=="POST"?url.slice ondataok=function(){ varxml=xh.responseXML,error if xml=xh.responseXML.documentElement if{ window.clipboardData.setData alert return } error=ndv if{ alert return } foo } if ondataok() xh.onreadystatechange=function(){ if ondataok() } }

    core.js: 复制代码 代码如下: sx={}; sx.comm={}; sx.comm.string=function(卡塔尔国{ if(!String.prototype.left){ String.prototype.left=function{ return this.substr; } } if(!String.prototype.right){ String.prototype.right=function{ return this.substr; } } if(!String.prototype.trim){ String.prototype.trim=function(){ return this.replace; } } }(); sx.comm.array=function(){ if(!Array.prototype.indexOf){ Array.prototype.indexOf=function{ for(var i=0;i=0;i--){ if{ break; } } return i; } } if(!Array.prototype.clone){ Array.prototype.clone=function(){ var temp=[]; for(var i=0;i"; return str ">" this.innerHTML "" this.tagName.toLowerCase; HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){ switch(this.tagName.toLowerCase{ case "area": case "base": case "basefont": case "col": case "frame": case "hr": case "img": case "br": case "input": case "isindex": case "link": case "meta": case "param": return false; } return true; }); XMLDocument.prototype.selectNodes = Element.prototype.selectNodes = function (){ //alert; var oNSResolver = this.createNSResolver var aItems = this.evaluate(arguments[0].toLowerCase(), this, oNSResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) var aResult = []; for( var i = 0; i < aItems.snapshotLength; i ) { aResult[i] = aItems.snapshotItem; } //alert(aItems.snapshotLength); return aResult; } } }(); sx.event={}; sx.event.target=function{ return window.event.srcElement; }else{ var f=arguments.callee.caller; while{ if(f.arguments[0] instanceof Event){ return f.arguments[0].target; } f=f.caller; } } } sx.event.event=function { return window.event; }else{ var f=arguments.callee.caller; while { if (f.arguments[0] instanceof Event) { return f.arguments[0]; } f = f.caller; } } } sx.event.relatedtarget=function{ if(window.event.type=="mouseover"){ return window.event.fromElement; }else if(window.event.type=="mouseout"){ return window.event.toElement; } }else{ var f=arguments.callee.caller; while { if (f.arguments[0] instanceof Event) { return f.arguments[0].relatedTarget; } f = f.caller; } } } sx.event.stopevent=function { window.event.returnValue=false; window.event.cancelBubble=true; }else{ var f=arguments.callee.caller; while{ if(f.arguments[0] instanceof Event){ break; } f=f.caller; } f.arguments[0].preventDefault(); f.arguments[0].stopPropagation(); } } sx.event.addevent=function{ if(!arguments.callee.event){ arguments.callee.event=[]; } if{ e.attachEvent; }else{ e.addEventListener; } arguments.callee.event.push; return arguments.callee.event.length-1; } sx.event.removeevent=function{ if{ e.detachEvent("on" t,sx.event.addevent.event[i]); }else{ e.removeEventListener(t,sx.event.addevent.event[i],false); } sx.event.addevent.event[i]=null; } sx.event.parseevent=function{ if { e.fireEvent; }else{ var evt = document.createEvent; evt.initEvent; e.dispatchEvent; } } sx.dom={}; sx.dom.text=function{ return this.e.innerText?this.e.innerText:this.e.innerHTML.replace; } sx.dom.elementnodes=function{ var temp=[]; var a=e.childNodes; for(var i=0;i" html); }else{ var oParser = new DOMParser; var x = oParser.parseFromString; //alert(x.documentElement.tagName); } var div=x.selectNodes; //alert; var temp=[]; var a1=x.selectNodes(e.tagName.toUpperCase; //alert; var all=e.getElementsByTagName; //alert; var i1=0; for{ //alert; if{ temp.push; i1 ; } } x=null; return temp; } sx.dom.left=function{ if(document.getBoundingClientRect){ return e.getBoundingClientRect().left; }else{ var a=e; var left=0; while{ left =a.offsetLeft; a=a.offsetParent; } return left; } } sx.dom.top = function{ if(document.getBoundingClientRect){ return e.getBoundingClientRect().top; }else{ var a=e; var top=0; while{ top =a.offsetTop; a=a.offsetParent; } return top; } } sx.dom.getstyle=function{ if{ return e.currentStyle[prop]; }else{ return document.defaultView.getComputedStyle.getPropertyValue; } } sx.dom.setstyle=function{ for{ e.style[i]=data[i]; } } advance.js: var $=function{ return document.getElementById; } edit.js: 复制代码 代码如下: var w=$.contentWindow; w.document.designMode="on"; w.document.open(卡塔尔国; w.document.write(""卡塔尔w.document.close(卡塔尔(قطر‎; if{ //w.document.body.style.lineHeight="10px"; } w.document.onkeydown=function(卡塔尔(英语:State of Qatar){ if{ if{ var s=w.document.selection.createRange(卡塔尔国; s.pasteHTML; return false; } } } function wnd(卡塔尔(قطر‎{ var main=document.createElement; sx.dom.setstyle(main,{ position:"absolute", width:"100%", height:"百分之百", backgroundColor:"lightblue", filter:"阿尔法", opacity:0.5 }卡塔尔(قطر‎; var body=document.createElement; sx.dom.setstyle(body,{ position:"absolute", width:"200px", height:"250px", backgroundColor:"green", zIndex:1000 }卡塔尔; var title=document.createElement; sx.dom.setstyle(title,{ width:"200px", height:"20px", backgroundColor:"blue", }卡塔尔(قطر‎; var close=document.createElement; sx.dom.setstyle(close,{ marginLeft:"180px", display:"block", width:"20px", height:"20px", textAlign:"center", cursor:"pointer" }卡塔尔国; close.innerHTML="X"; close.onclick=function(卡塔尔(قطر‎{ main.parentNode.removeChild; body.parentNode.removeChild; } title.appendChild; body.appendChild; var content=document.createElement; sx.dom.setstyle(content,{ width:"200px", height:"230px" }卡塔尔(英语:State of Qatar); body.appendChild; this.show=function{ document.body.appendChild; sx.dom.setstyle(main,{ top:"0px", left:"0px" }卡塔尔(قطر‎; document.body.appendChild; sx.dom.setstyle(body,{ top:sx.dom.top e.clientHeight "px", left:sx.dom.left e.clientWidth "px", }卡塔尔(英语:State of Qatar); } this.close=close; this.main=main; this.body=body; this.title=title; this.content=content; } function bold(卡塔尔{ w.document.execCommand; } function italic(卡塔尔(قطر‎{ w.document.execCommand; } function left(卡塔尔(قطر‎{ w.document.execCommand("JustifyLeft",null,null卡塔尔(英语:State of Qatar); } function center(卡塔尔国{ w.document.execCommand("Justifycenter",null,null卡塔尔; } function right(卡塔尔(英语:State of Qatar){ w.document.execCommand("Justifyright",null,null卡塔尔(英语:State of Qatar); } function FontName{ w.document.execCommand("FontName", false, value卡塔尔国; } function FontSize{ w.document.execCommand("FontSize", false, value卡塔尔(英语:State of Qatar); } function inserthr(卡塔尔(قطر‎{ if{ w.focus(卡塔尔(قطر‎; var s=w.document.selection.createRange(卡塔尔国; s.pasteHTML; }else{ w.focus(卡塔尔(英语:State of Qatar); var s=w.getSelection; s.insertNode(w.document.createElement; } } function insertlink(卡塔尔{ if { w.focus(卡塔尔国; var s = w.document.selection.createRange; var s = w.getSelection; } var e=sx.event.target; ww.content.appendChild(document.createTextNode; var link=document.createElement; link.type="text"; link.size=20; ww.content.appendChild; var b=document.createElement; b.innerHTML="鲜明"; ww.content.appendChild; b.onclick=function(卡塔尔国{ if{ s.pasteHTML("" s.htmlText ""); } else{ var a=w.document.createElement; a.href=link.value; s.surroundContents; } sx.event.parseevent; } ww.show; } function inserttable(){ if { w.focus(); var s = w.document.selection.createRange; var s = w.getSelection; } var e=sx.event.target; ww.content.appendChild(document.createTextNode; var tr=document.createElement; tr.type="text"; tr.size=20; ww.content.appendChild; ww.content.appendChild(document.createElement; ww.content.appendChild(document.createTextNode; var td=document.createElement; td.type="text"; td.size=20; ww.content.appendChild; ww.content.appendChild(document.createElement; ww.content.appendChild(document.createTextNode; var height=document.createElement; height.type="text"; height.size=20; ww.content.appendChild; ww.content.appendChild(document.createElement; ww.content.appendChild(document.createTextNode; var width=document.createElement; width.type="text"; width.size=20; ww.content.appendChild; ww.content.appendChild(document.createElement; var b=document.createElement; b.innerHTML="确定"; ww.content.appendChild; b.onclick=function(){ var l1=Number; var l2=Number; var h1=Number; var w1=Number; ww.content.appendChild(document.createTextNode; var t=document.createElement; t.border="1"; var tb=document.createElement; t.appendChild; for{ var tr1=document.createElement; for{ var td1=document.createElement; td1.innerHTML=""; sx.dom.setstyle(td1,{ width:w1 "px", height:h1 "px" }); tr1.appendChild; } tb.appendChild; } if{ s.pasteHTML; } else{ s.insertNode; s.insertNode(document.createElement; } sx.event.parseevent; } ww.show; } function color(){ var e=sx.event.target(); if { w.focus(); var s = w.document.selection.createRange; var s = w.getSelection; } var ww=new wnd(); var colors = ["00","33","66","99","CC","FF"]; var cp=document.createElement; sx.dom.setstyle(cp,{ display:"inline-block", width:"10px", height:"10px", margin:"2px" }); for{ for{ for{ var cp1=cp.cloneNode; cp1.style.backgroundColor="#" colors[i1] colors[i2] colors[i3]; cp1.title="#" colors[i1] colors[i2] colors[i3]; cp1.onclick=function(卡塔尔{ if{ w.focus(卡塔尔; s.pasteHTML("" s.htmlText ""卡塔尔; } else{ var a=w.document.createElement; a.color=this.title; s.surroundContents; } sx.event.parseevent; } ww.content.appendChild; } } } ww.show; } 关键是demo.html和edit.js里的代码,core.js和advance.js里的代码是自身为协作浏览器写的,本想把它扩展成一个周到的框架的,因为时间少于,就没写下去了。本编辑器还并未有兑现图片和文件的上传,因为供给服务器本事,所以小编就没写了,能够交到读者稳步钻探。 小编筹算先将web放放了,初阶专心于vc 的研究上,尽量能写出叁个近乎的次序出来,未来要是不常光笔者也会持续康健那几个编辑器以至javascript宽容的框架。 恩,好好加油啊。

    本文由新葡亰496net发布于服务器网络,转载请注明出处:幻宇职业室用到js,超强推荐share

    关键词: