Created
May 1, 2016 17:31
-
-
Save Jaskaranbir/cb17e74962118f7e38ab5eded4deb20e to your computer and use it in GitHub Desktop.
A simple web editor that displays results dynamically as you type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Dynamic Web Editor</title> | |
</head> | |
<body> | |
<style> | |
body{ | |
margin:0; | |
} | |
textarea{ | |
height: 50%; | |
width: 33.33%; | |
float:left; | |
} | |
iframe{ | |
width:100%; | |
height: 50%; | |
} | |
</style> | |
<textarea placeholder="HTML" id="h"></textarea> | |
<textarea placeholder="CSS" id="c"></textarea> | |
<textarea placeholder="JS" id="j"></textarea> | |
<iframe id="f"></iframe> | |
<script> | |
document.getElementsByTagName('body')[0].addEventListener('keypress', | |
function(){f.srcdoc = h.value + ' <style> ' + c.value + ' </style> <script>' + j.value + ' <\/script>';} | |
); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment