<script language="javascript">
var script = document.createElement("script");
script.language = "javascript";
script.text = "alert('hello world!')";
document.body.appendChild(script);
</script>
另一方法:
http://blog.csdn.net/renfufei/article/details/18039237