body新增script

var scriptElement = document.createElement('script');
scriptElement.type = 'text/javascript';
//注意"\n"跳脫字元,要取代成"\\n"
scriptElement.innerHTML = "alert('Hi');";
document.getElementsByTagName("head")[0].appendChild(scriptElement);