Skip to content

Commit 26f030e

Browse files
committed
add 运行函数
1 parent d6a78ed commit 26f030e

29 files changed

+13
-4522
lines changed

lib/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ var JSeditor = CodeMirror.fromTextArea(document.getElementById("_js"), {
1414
lineNumbers: true,
1515
mode: 'javascript'
1616
});
17-
var iframeDOM=document.getElementById("preview").contentDocument;
18-
iframeDOM.write(HTMLeditor.getValue());
1917
addCSS();
2018
addJS();
2119
function addCSS () {
20+
var iframeDOM=document.getElementById("preview").contentDocument;
21+
iframeDOM.write(HTMLeditor.getValue());
2222
var style=document.createElement("style");
2323
style.innerHTML=CSSeditor.getValue();
2424
iframeDOM.body.appendChild(style);
@@ -30,4 +30,14 @@ function addJS(){
3030
iframeDOM.body.appendChild(script);*/
3131

3232
setTimeout(function(){document.getElementById("preview").contentWindow.eval(JSeditor.getValue());},1000);
33+
}
34+
function runCode(){
35+
var a=document.getElementById("preview");
36+
a.parentNode.removeChild(a);
37+
var iframe=document.createElement("iframe");
38+
iframe.setAttribute("frameborder","0");
39+
iframe.setAttribute("id","preview");
40+
document.getElementById("pre").appendChild(iframe);
41+
addCSS();
42+
addJS();
3343
}

mode/css/index.html

Lines changed: 0 additions & 70 deletions
This file was deleted.

mode/css/less.html

Lines changed: 0 additions & 152 deletions
This file was deleted.

mode/css/less_test.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)