<pre id="list_css" class="brush:css;toolbar:false">/*外部css,多个换行*/ https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css</pre> <pre id="list_js" class="brush:js;toolbar:false">/*外部js,多个换行*/ https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js</pre> <pre id="css" class="brush:css;toolbar:false">/*css*/ .test{ background:red; color:white; }</pre> <pre id="html" class="brush:html;toolbar:false"><!--dom--> <div class="progress"> <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 40%;"> <span class="sr-only">40% 完成</span> </div></div></pre> <pre id="js" class="brush:js;toolbar:false">/*js*/ $(function(){ var person = { name: 'wayne zhu', age: 22, school: 'xjtu' } window.name = JSON.stringify(person) });</pre> <p style="text-align:center;"> <br/>end </p><script>/*init*/ String.prototype.replaceAll = function (sold, snew) { return this.replace(new RegExp(sold, "gm"), snew); } String.prototype.replaceChar = function(){ return this .replaceAll("&.lt;".replace(".",""), "<") .replaceAll("&.gt;".replace(".",""), ">") .replaceAll("&.amp;".replace(".",""), '&') .replaceAll("&.quot;".replace(".",""), '"') .replaceAll("&.#39;".replace(".",""),"'") .replaceAll("&.nbsp;".replace(".",""), " "); } var doc = { pres:document.getElementsByTagName("pre"), hidePresId:["list_css","list_js","css","html","js"], temp_style:"", temp_script:"", str_list_style:document.getElementById("list_css").innerHTML.split("\n").reverse(), str_list_script:document.getElementById("list_js").innerHTML.split("\n"), style:document.createElement("style"), dom:document.createElement("div"), script:document.createElement("script"), str_style:document.getElementById("css").innerHTML + "", str_dom:document.getElementById("html").innerHTML + "", str_script:document.getElementById("js").innerHTML + "", body:document.getElementsByTagName('body')[0], html:document.getElementsByTagName('html')[0], target:document.getElementsByTagName("pre")[0], head:document.getElementsByTagName("head")[0], url_reg:/^[a-zA-z]+:\/\/[^\s]*$/ } for (var i = 0; i < doc.hidePresId.length; i++) { document.getElementById(doc.hidePresId[i]).style.display = "none"; } for (var i = 0; i < doc.str_list_style.length; i++) { if(doc.url_reg.test(doc.str_list_style[i])){ doc.temp_style=document.createElement("link"); doc.temp_style.rel="stylesheet"; doc.temp_style.type="text/css"; doc.temp_style.href=doc.str_list_style[i]; doc.head.insertBefore(doc.temp_style,document.head.firstChild); } } for (var i = 0; i < doc.str_list_script.length; i++) { if(doc.url_reg.test(doc.str_list_script[i])){ doc.temp_script=document.createElement("script"); doc.temp_script.type="text/javascript"; doc.temp_script.src=doc.str_list_script[i]; doc.head.appendChild(doc.temp_script); } } doc.str_style=doc.str_style.replaceChar(); doc.style.innerHTML = doc.str_style; doc.body.parentNode.insertBefore(doc.style, doc.body); doc.dom.style.width = "100%"; doc.str_dom = doc.str_dom.replaceChar(); doc.dom.innerHTML = doc.str_dom; doc.target.parentNode.insertBefore(doc.dom,doc.target); doc.str_script=doc.str_script.replaceChar(); doc.script.innerHTML = doc.str_script; doc.html.appendChild(doc.script); doc = null;</script>
测试签名内容