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

请教html中关于cookies的问题
<TR>
<TD style="HEIGHT: 20px" colSpan="3"><A href="sfzy.aspx?xm_id=06-28-01" target="main"><%=trim("" & Server.UrlDecode(Request.Cookies("zy_name").Value))%></A></TD>
</TR>

想在页面中根据cookies的值来显示,如上所示怎么放到一个超链接中间就出错呢?

像下面这样,如果不在超链接中间就又没有问题:

<td style="HEIGHT: 20px" bgColor="#d6dff7">用户:<font color="red">&nbsp;<%=trim("" & Server.UrlDecode(Request.Cookies("user_name").Value))%>&nbsp;(<%=trim("" & Server.UrlDecode(request.Cookies("dept_name").Value))%>
)</font>
</td>



------解决方案--------------------
C# code

 <tr>
    <td style="height: 20px" colspan="3">
       <a href="sfzy.aspx?xm_id=06-28-01" target="main">
         <%= (Server.UrlDecode(Request.Cookies["zy_name"].Value)).ToString().Trim()%> 
       </a>
    </td>
    <td>
        <%= (Server.UrlDecode(Request.Cookies["myCookie"].Value)).ToString().Trim()%> 
    </td>
</tr>

------解决方案--------------------
<TR > 
<TD style="HEIGHT: 20px" colSpan="3" > <A href="sfzy.aspx?xm_id=06-28-01" target="main" > <%=Server.UrlDecode(Request.Cookies("zy_name").Value)).Trim()%> </A > </TD > 
</TR >