html页面是表单value点位符@在浏览器显示出来?
<body><form action="Calcu1.ashx">
<input type="hidden" name="IspostBack" value="true" />
<input type="text" value="@num1" name="num1" />+<input type="text" value="@num2" name="num2"/><input type="submit" value="=" />
<input value="@result" type="text" readonly="readonly" />
</form>
</body>
第一次进html页面是action没提交,地址仍是http://localhost:54502/WebSite1/Calcu.htm
把@num1+@num2=@result画了出来,怎样解决?
点了“=”号后倒正常了!http://localhost:54502/WebSite1/Calcu1.ashx?IspostBack=true&num1=2&num2=4
谢谢!
context.Response.ContentType = "text/html";
string IspostBack = context.Request["IspostBack"];
string result = "";
string num1 = "";
string num2 = "";
if (IspostBack == "true")
{
num1 = context.Request["num1"];
num2 = context.Request["num2"];
result = (Convert.ToInt32(num1) + Convert.ToInt32(num2)).ToString();
}
else
{
result = "";
num1 = "";
num2 = "";
}
string htm模板文件全路径 = context.Server.MapPath("Calcu.htm");
string content = System.IO.File.ReadAllText(htm模板文件全路径);
content = content.Replace("@num1", num1);
content = content.Replace("@num2", num2);
content = content.Replace("@result", result);
context.Response.Write(content); --------------------编程问答-------------------- 我抄来的代码反复对照了没错,我是复习的,以前抄这个没这问题,是不是哪里的配置的问题? --------------------编程问答-------------------- 你第一次进这个页面的时候给那2个num赋个默认值0,要么写个三元没值的时候不显示
补充:.NET技术 , ASP.NET