2012-05-28 240 views
1

我有這段代碼被破壞了。由於單引號和雙引號。用雙引號括起來的單引號中的單引號

我應該如何逃生才能使它工作?

<a href="path" rel="example_group" title="<a href='/Home/Vote/@item.Id'><img src='/Content/images/021.png' style='float:left; margin-left:45%;' /></a><a onClick='window.open('test.com','sharer','toolbar=0,status=0,width=548,height=325');' href='javascript: void(0)'><img src='/Content/images/022.png' /></a>"><img src="@Url.Action("ViewImage", "Image", new { id = item.Id, imageType="thumb" })" alt="" width="100" height="100" /> </a> 

window.open正在打破它。

我怎樣才能解決這個問題?我試過逃跑,但沒有運氣。

請查看該代碼是否在標題中。所以我不能用雙引號。

+0

'「>」'''''''''''''''''或者我誤會了嗎?因爲我根本看不到任何匹配,我相信你想要一個' Brendan

+0

這是內部標題。 – DarthVader

回答

3

在單引號內使用雙引號。

<a onClick='window.open("test.com","sharer","toolbar=0,status=0,width=548,height=325");'

或者打開和關閉用雙引號

<a onClick="window.open('test.com','sharer','toolbar=0,status=0,width=548,height=325');"

編輯

可以代替雙引號的使用&quot;。如果您需要將該HTML寫回某處,則可以在當時將&quot;替換爲"

編輯

This相似,所以問題可能會有幫助。 `

+0

請閱讀問題。標題中使用雙引號。 – DarthVader

+0

所有這些HTML都在標題文本中? – jwatts1980

+0

是的。這就是爲什麼我問。否則duhhhh人。 – DarthVader