<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8" />
<title>Javascript Mini Lab</title>
</head>
<body>
<form method="post">
Javascript Mini Lab<br />
<textarea name="txtScript" id="txtScript"
style="width: 600px; height: 200px"></textarea><br />
<input name="btnRunScript" type="button" value="Run Script"
onclick="eval(document.getElementById('txtScript').value);"/>
<input name="btnRunDocument" type="button" value="Run HTML"
onclick="buildWebPage();" />
<hr />
<script type="text/javascript">
function showMsg(x) {
document.getElementById("spnOutput").innerHTML=x;
}
function buildWebPage() {
var html=document.getElementById('txtScript').value;
var xwin=window.open("about:blank");
xwin.document.write(html);
}
</script>
<div id="spnOutput"
style="width: 600px; height:100px; background-color:#CCCCCC">
* You can use
<font color="green">showMsg(<i>varName</i>);</font>
to display message here.<br />
</div>
</form>
</body></html>