用了response.write,所有效果都被置顶了,发现在<table>以外的部位,那应该怎么把他调到<td>里面阿?
<script Language="C#" runat="server">
public class Book
{
private string title;
private double price;
private double ukprice;
private double usprice;
private double canprice;
public string Title
{
get
{
return title;
}
set
{
title=value;
}
}
public double Price
{
get
{
return price;
}
}
public Book()
{
title="ASP.net and C# begining";
price=38.56;
}
public void ChangePrice(string strMoney)
{
if(strMoney.ToLower()=="pound")
price/=9.98;
if(strMoney.ToLower()=="dollar")
price/=7.00;
if(strMoney.ToLower()=="cad")
price/=5.98;
}
public Book(string newtitle,double newprice)
{
title=newtitle;
price=newprice; }
}
void Page_Load()
{
Book MyBook=new Book();
Response.Write("The book's title is: "+MyBook.Title+"<br/>");
Response.Write("The book's price is: "+MyBook.Price+"<br/><br/>");
Book NewBook=new Book("Help yourself study of ASP.net", 70);
NewBook.ChangePrice("pound");
Response.Write("The new book's title is: "+NewBook.Title+"<br/>");
Response.Write("The new book's price is: "+NewBook.Price+"<br/><br/>");
}
</script>
<html>
<body>
<table border="1" width="100%" longth="100%">
<tr bgcolor="orange">
<td>g</td> <td>h</td> <td>k</td>
</tr><tr bgcolor="red"><td colspan="2">rr我想把结果显示到这里</td><td>v</td></tr>
<tr bgcolor="red"><td colspan="2">rr我想把结果显示到这里</td><td>v</td></tr></table>
</body>
</html>
<script Language="C#" runat="server">
public class Book
{
private string title;
private double price;
private double ukprice;
private double usprice;
private double canprice;
public string Title
{
get
{
return title;
}
set
{
title=value;
}
}
public double Price
{
get
{
return price;
}
}
public Book()
{
title="ASP.net and C# begining";
price=38.56;
}
public void ChangePrice(string strMoney)
{
if(strMoney.ToLower()=="pound")
price/=9.98;
if(strMoney.ToLower()=="dollar")
price/=7.00;
if(strMoney.ToLower()=="cad")
price/=5.98;
}
public Book(string newtitle,double newprice)
{
title=newtitle;
price=newprice; }
}
void Page_Load()
{
Book MyBook=new Book();
Response.Write("The book's title is: "+MyBook.Title+"<br/>");
Response.Write("The book's price is: "+MyBook.Price+"<br/><br/>");
Book NewBook=new Book("Help yourself study of ASP.net", 70);
NewBook.ChangePrice("pound");
Response.Write("The new book's title is: "+NewBook.Title+"<br/>");
Response.Write("The new book's price is: "+NewBook.Price+"<br/><br/>");
}
</script>
<html>
<body>
<table border="1" width="100%" longth="100%">
<tr bgcolor="orange">
<td>g</td> <td>h</td> <td>k</td>
</tr><tr bgcolor="red"><td colspan="2">rr我想把结果显示到这里</td><td>v</td></tr>
<tr bgcolor="red"><td colspan="2">rr我想把结果显示到这里</td><td>v</td></tr></table>
</body>
</html>
解决方案 »
- C# 谁能提供一个好些的 DBHelper的类
- 如何 在codeBehind 代码里 判断 DropDownList1 SelectedValue 是否有效
- 有用ReportViewer制作柱状图的例子或教程吗?高分送上~~
- ASP.NET中超链接问题
- ASP.net 的Session之间如何传递数据?
- 数据格式化的问题~~
- asp.net网站发布的问题
- showModalDialog网页对话框关闭时刷新父窗口时,弹出这样的提示框"请重新发送消息,无法刷新网页"
- 倾家荡产的提问!如何把图片放进dropdownlist里?
- 关于asp.net的创建问题
- 求助 “ConnectionString 属性尚未初始化”错误 ,因为困扰了我一晚上了请大家帮帮忙!
- [有趣]这是什么原因????
Response.Write("<table>");
.....
Response.Write("</table>");
然后后台this.a.innerhtml="there are your words!";
public b as string
在void Page_Load() 中赋值:
a="The book's title is: "+MyBook.Title+" <br/>";
b="The new book's price is: "+NewBook.Price+" <br/> <br/>"
显示的时候这样:<tr bgcolor="red"> <td colspan="2"> <%#a%> </td> <td>v </td> </tr>
<tr bgcolor="red"> <td colspan="2"> <%#b%></td> <td>v </td> </tr>