Created
October 22, 2014 04:37
-
-
Save cheng470/7a95a4cfe201e8d483e4 to your computer and use it in GitHub Desktop.
通过弹窗运行代码
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>run code</title> | |
</head> | |
<body> | |
<textarea name="txt" id="txt" cols="40" rows="10"></textarea> | |
<br /> | |
<input type="button" id="btn" value="Run"> | |
<script> | |
window.onload = function() { | |
var txt = document.getElementById("txt"); | |
var btn = document.getElementById("btn"); | |
btn.onclick = function() { | |
window.open("about:blank", "_blank").document.write(txt.value); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment