2012-05-28 58 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