protected string bnaner()
{
StringBuilder sb = new StringBuilder();
bool ifurl = false;
string tpname = "hoticp.swf";
string tpname2 = "titlebg.jpg";
string tplink = "http://www.sohu.com";
if (ifurl == true)
{
sb.AppendFormat("<object width=\"948\" height=\"80\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\">" +
"<param value=\"/tp/{0}\" name=\"movie\"/>" +
"<param value=\"high\" name=\"quality\"/>" +
"<param value=\"false\" name=\"menu\"/>" +
"<param value=\"opaque\" name=\"wmode\"/>" +
"<embed width=\"948\" height=\"80\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" false=\"\" wmode=\"opaque\" src=\"/tp/{0}\"/>" +
"</object>", tpname);
}
else
{
sb.AppendFormat("<a href=\"{1}\" target=\"_blank\" onFocus=\"this.blur()\"><img src=\"/tp/{0}\" width=\"948\" height=\"80\"></a>", tpname2, tplink);
}
return sb.ToString();
}
protected string classad(int c1)
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
SqlDataReader rs = newdb.CommonExecuteReader("select top " + c1 + " Title,ID,DateAndTime from News order by ID desc");
while (rs.Read())
{
sb.AppendFormat("<tr><td>{2}</td><td><a href=\"abc.aspx?id={1}\" target=\"_blank\">{0}</a></td></tr>", rs[0], rs[1], Convert.ToDateTime(rs[2]).ToString("M-d"));
}
sb.AppendFormat("</table>");
rs.Close();
return sb.ToString();
}
{
StringBuilder sb = new StringBuilder();
bool ifurl = false;
string tpname = "hoticp.swf";
string tpname2 = "titlebg.jpg";
string tplink = "http://www.sohu.com";
if (ifurl == true)
{
sb.AppendFormat("<object width=\"948\" height=\"80\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\">" +
"<param value=\"/tp/{0}\" name=\"movie\"/>" +
"<param value=\"high\" name=\"quality\"/>" +
"<param value=\"false\" name=\"menu\"/>" +
"<param value=\"opaque\" name=\"wmode\"/>" +
"<embed width=\"948\" height=\"80\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" false=\"\" wmode=\"opaque\" src=\"/tp/{0}\"/>" +
"</object>", tpname);
}
else
{
sb.AppendFormat("<a href=\"{1}\" target=\"_blank\" onFocus=\"this.blur()\"><img src=\"/tp/{0}\" width=\"948\" height=\"80\"></a>", tpname2, tplink);
}
return sb.ToString();
}
protected string classad(int c1)
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
SqlDataReader rs = newdb.CommonExecuteReader("select top " + c1 + " Title,ID,DateAndTime from News order by ID desc");
while (rs.Read())
{
sb.AppendFormat("<tr><td>{2}</td><td><a href=\"abc.aspx?id={1}\" target=\"_blank\">{0}</a></td></tr>", rs[0], rs[1], Convert.ToDateTime(rs[2]).ToString("M-d"));
}
sb.AppendFormat("</table>");
rs.Close();
return sb.ToString();
}
前台调用
<table border="1" cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td>
<%=bnaner()%>
</td>
<td>
</td>
</tr>
<tr>
<td>
<%=classad(5) %>
</td> <td>
</td>
</tr> </table>
<tr>
<td>
<%=bnaner()%>
</td>
<td>
</td>
</tr>
<tr>
<td>
<%=classad(5) %>
</td> <td>
</td>
</tr> </table>