Skip to content

Instantly share code, notes, and snippets.

@sadah
Created September 19, 2012 14:41
Show Gist options
  • Save sadah/3750042 to your computer and use it in GitHub Desktop.
Save sadah/3750042 to your computer and use it in GitHub Desktop.
jsを試すためのテキストエリア
<!DOCTYPE HTML>
<html lang="jp">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
window.onload=function(){
var elm = document.getElementById("exec");
elm.addEventListener("click", function (e) {
var log = document.getElementById("log");
var js = document.getElementById("js")
log.innerHTML += String(eval(js.value)).replace(/</g,"&lt;").replace(/>/g,"&gt;") + "<br />";
}, false);
}
</script>
</head>
<body>
<textarea name="js" id="js" cols="30" rows="10">alert(0);
document.body.innerHTML;</textarea><br />
<button type="button" id="exec">exec</button><br />
<div id="log"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment