Since I had to open the favorite text editor to create HTML page to perform CSS and JScript tests, I decided to create a personal page based on some aspects of third-party sites like "Jsfiddle", a very simple code, I'm not proud of him. I just did it because it speeds up my development without first having to create the final file (HTML document).
Code
<html>
<head>
<style>
#menu-vertical
{
position: fixed;
z-index: 999;
overflow: hidden;
border-right: 1px dashed silver;
padding: 5px;
height:100%;
float: left;
}
textarea
{
width: 100%;
height: 150px;
border: 3px solid silver;
padding: 5px;
font-family: Tahoma, sans-serif;
background-color: azure;
background-position: bottom right;
background-repeat: no-repeat;
}
input
{
width: 90px;
border: 1px solid gray;
padding: 5px;
}
</style>
<script>
<!--
function pop()
{
var js = document.getElementById("JS").value;
var html = document.getElementById("HTML").value;
var css = document.getElementById("CSS").value;
var janela = window.open("", "janela","width=500px, height=500px, scrollbars=yes");
janela.document.write("<html>\n<head>\n");
janela.document.write("<style>\n"+css+"\n</style>\n");
janela.document.write("</head>\n<body>\n"+html+"\n");
janela.document.write("</body>\n<script>\n"+js+"\n");
janela.document.write("</script>\n</html>");
}
//-->
</script>
</head>
<body>
<!-- Editor Lang.: CSS - HTML - JS -->
<div id="menu-vertical">
<br><b>CSS:</b><br>
<textarea id="CSS" cols="39" rows="9" size="1"></textarea>
<br><b>HTML:</b><br>
<textarea id="HTML" cols="39" rows="9" size="1"></textarea>
<br><b>JScript:</b><br>
<textarea id="JS" cols="39" rows="9" size="1"></textarea>
<center>
<hr color="silver" width="100%" size="1"/>
<input type="button" value="Executar" onclick="pop()"/>
</div>
<!-- Fim -->
</center>
</body>
</html>
var js = document.getElementById("JS").value;
var html = document.getElementById("HTML").value;
var css = document.getElementById("CSS").value;
Dynamic iframe
pag = function ()
{
var el = document.createElement('iframe');
el.setAttribute('id','exibir') ;
el.width ="100%";
el.height="100%";
document.body.appendChild(el);
}
I quote something related to this question ..
Diddle - "This is a simplified clone of jsFiddle created by nwoike"
Source: How to create a simplified version of jsFiddle