我想在aspx頁面中使用response.write返回一個javascript函數。問題是我返回的函數有很多引號,它們與repsonse.write語法衝突。下面是一個示例代碼:通過Response.Write()回寫函數
Response.Write(" If hello.StartsWith("H", StringComparison.InvariantCultureIgnoreCase) OrElse hello.StartsWith("W", System.StringComparison.InvariantCultureIgnoreCase) Then")
這給了我一個問題,因爲引號內及早切斷響應。有一個更好的方法嗎?
爲什麼不把它放在.aspx標記中。 – McGarnagle 2012-04-12 17:41:47
您是否嘗試過轉義引號?就像:'Response.Write(「如果hello.StartsWith(\」H \「,...'或者你甚至可以用單引號來包裝內部函數:'Response.Write('if hello.StartsWith(」H「 ,... Then');' – faino 2012-04-12 17:43:37
aspx標記到底是什麼?我需要將這個響應寫入一個函數,所以我不能準確地使用代碼塊,如果這就是你的意思 – 2012-04-12 17:44:36