2012-05-28 44 views
-1

我必須通過動態的jQuery錯誤動態加載HTML通過有一個腳本的jQuery

$("table").eq(5).html('<table><tr><td>some data</td></tr></table><script language="JavaScript">function TCN_reload(from){}</script><table><tr><td>some data</td></tr></table>'); 

寫加載HTML代碼。如果我用這個代碼,然後遇到頁面加載錯誤。 但如果我刪除該腳本,那麼沒有錯誤,但我也想要那個腳本。

請幫我一把!

謝謝!

+1

喲 - 你在裏面設置表的表? –

+0

你想要......? – gsagrawal

+0

[在jQuery中添加腳本標記]的可能重複(http://stackoverflow.com/questions/8538146/add-script-tag-in-jquery) – Quentin

回答

0

更改<script language="javascript"><script type="text/javascript">。檢查下面

type = content-type :

This attribute specifies the scripting language of the elements contents and overrides the default scripting language. The scripting language is specified as a content type (e.g., "text/javascript"). We have to supply a value for this attribute. There is no default value for this attribute. 

language ="JavaScript" :

This attribute specifies the scripting language of the contents of this element. Its value is an identifier for the language, but since these identifiers are not standard, this attribute has been deprecated(outdated by newer constructs) in favor of type. 
+0

從HTML 3.2切換到HTML 4.x不會有任何區別。 – Quentin