87,839
社区成员




<input type="button" value="运行代码" onclick="runCode()"/>
<table border="1">
<tr><td><textarea id="ta" role="5" cols="50" style="height:300px;width:500px">
<html>
<head>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
<script>
window.onload=function(){
$("p").click(function () {
$(this).hide();
});
}
</script>
</head>
<body>
<p>如果您点击我,我会消失。</p>
<p>点击我,我会消失。</p>
<p>也要点击我哦。</p>
</body>
</html>
</textarea></td>
<td><iframe id="ifrCode" frameborder="0" marginheight="0" marginwidth="0" style="height:300px;width:500px"></iframe></td></tr>
</table>
<script>
var ta = document.getElementById('ta'), ifrCodeDoc = document.getElementById('ifrCode')
function runCode() {
ifrCodeDoc.contentWindow.document.open();
ifrCodeDoc.contentWindow.document.write(ta.value);
ifrCodeDoc.contentWindow.document.close();
}
</script>