asp.net 变量输出问题

来源:百度知道 编辑:UC知道 时间:2024/06/24 06:35:13
<head id="Head1" runat="server">
<meta name="keywords" content=" <%=pIntro%>" />
可是输出到前台却是变成了
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="ctl00_Head1"> <title>
无标题页
</title> <meta name="keywords" content="<%=pIntro%>" />
没对 <%=pIntro%>进行解释,却把“ <”弄成了<如果放在mdta外则正常,请问是怎么回事?

把双引号去掉!

你head是放在哪的 生成之后id就成ctl00_Head1了?这个是放在控件里加上runat才会加上前面的ctl00_1的。。。难道说你控件里有head?

双引号换成单引号
<meta name="keywords" content='<%=pIntro%>'/>

<head id="ctl00_Head1" runat ="server">