-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.js
More file actions
28 lines (25 loc) · 953 Bytes
/
compile.js
File metadata and controls
28 lines (25 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function Compile(){
var com='';
chk=document.getElementById('check').checked
if (chk){
com=true;
}
else{
com=false;
}
if (com){
document.getElementById('iframe').srcdoc=document.getElementById('HTML').value+"\n<style>\n"+document.getElementById('CSS').value+'\n</style>'+"\n<script>"+document.getElementById('JS').value+'\n</script>';
}
else{
}
}
function Run(){
document.getElementById('iframe').srcdoc=document.getElementById('HTML').value+"\n<style>\n"+document.getElementById('CSS').value+'\n</style>'+"\n<script>"+document.getElementById('JS').value+'\n</script>';
}
function Download(){
var element = document.createElement('a');
code=document.getElementById('iframe').srcdoc;
element.setAttribute('href', 'data:text/text;charset=utf-8,' + encodeURI(code));
element.setAttribute('download', "index.html");
element.click();
}