日期:2014-05-18  浏览次数:20432 次

引號
在cs有s1

string   s1=   " <a   style= 'CURSOR:   hand '     onClick=\ " "+ "window.open( 'shenqing.aspx?id_no= <%#   DataBinder.Eval(Container.DataItem,\ "id_no\ ")   %> ', ' ', 'height=265,width=595,top=200,left=200 ')\ " "+ "   > <font   color=#0063dc> 申请 </font> </a> ";


這裡的引號有些問題

我想得到s1的值(.aspx里的值)為

<a   style= 'CURSOR:   hand '     onClick= "window.open( 'shenqing.aspx?id_no= <%#   DataBinder.Eval(Container.DataItem, "id_no ")   %> ', ' ', 'height=265,width=595,top=200,left=200 ') "   > <font   color=#0063dc> 申请 </font> </a>

怎麼修改這些引號才能正確顯示

------解决方案--------------------
string s1 = " <a style= 'CURSOR: hand ' onClick=\ "window.open( 'shenqing.aspx?id_no= <%# DataBinder.Eval(Container.DataItem,\ "id_no\ ") %> ', ' ', 'height=265,width=595,top=200,left=200 ')\ " > <font color=#0063dc> 申请 </font> </a> ";
------解决方案--------------------
//楼主的写法就可以得到.我对比了一下.没问题.
//其它地方可能有问题
<a style= 'CURSOR: hand ' onClick= "window.open( 'shenqing.aspx?id_no= <%# DataBinder.Eval(Container.DataItem, "id_no ") %> ', ' ', 'height=265,width=595,top=200,left=200 ') " > <font color=#0063dc> 申请 </font> </a>

<a style= 'CURSOR: hand ' onClick= "window.open( 'shenqing.aspx?id_no= <%# DataBinder.Eval(Container.DataItem, "id_no ") %> ', ' ', 'height=265,width=595,top=200,left=200 ') " > <font color=#0063dc> 申请 </font> </a>

------解决方案--------------------
想打印双引号就用转义字符 \ " 单引号直接加上就可以了
------解决方案--------------------
可以这样

<script type= "text/javascript ">
function XX()
{
window.open( ' <%# DataBinder.Eval(Container, "DataItem.id_no ") %> ', ' ', 'height=265,width=595,top=200,left=200 ')
}
</script>

<a style= "CURSOR: hand " onClick= "XX(); "> <font color= "#0063dc "> 申请 </font> </a>