加defer属性是有用的,参考: <script   type= "text/javascript "> 
function   hello(){ 
alert( "hello,world! "); 

function   testih(){ 
var   s   =   "test! "; 
s   +=   " <script   language= 'javascript '   type= 'text/javascript '   defer> "; 
s   +=   "hello(); "; 
s   +=   " < "+ "/script> "; 
document.getElementById( "t ").innerHTML   =   s; 

</script> <div   id= "t "> </div> 
<input   type= "button "   value= "test "   onclick= "testih(); ">