一个简单的新闻系统之三
显示新闻:
show.jsp

<%@page contentType="text/html;charset=GB2312"%>
<%@include file=
"inc.jsp"%>
<Script language=
"JavaScript">
//打开新窗口函数NewsWindow
function NewsWindow(id)
{
window.open('newswind.jsp?id='+id,'infoWin', 'height=400,width=600,scrollbars=yes,resizable=yes');
}
</Script>
<%
sql=
"select * from new_sz order by id desc";
rs=apple.select(sql);
%>
<html>
<head>
<title>新闻</title>
</head><%@include file=
"head.htm"%>
<body bgcolor=
"#999999">
<table border=1 align='center' width='71%'>
<tr>
<td width=
"47%">
<div align=
"center">主题</div>
</td>
<td width=
"21%">
<div align=
"center">作者</div>
</td>
<td width=
"32%">
<div align=
"center">时间</div>
</td>
</tr>
<%
while(rs.next() )
{
%>
<%
int cc = 1;
do {
// 不同行之间以不同颜色显示
if(cc % 2 == 1)
out.println(
"<tr bgcolor=#E7E7E7>");
else
out.println(
"<tr BGCOLOR=#F4F4F4>");
%>
<td width=
"47%"><a href="javascript:NewsWindow(<%=rs.getInt("ID")%>)"><u>
<%String title=rs.getString(
"title");
title=new String(title.getBytes(
"ISO-8859-1"),"GB2312" );
%>
<%=title%></u></a></td>
<td width=
"21%" align="center">
<%String author=rs.getString(
"author");
author=new String(author.getBytes(
"ISO-8859-1"),"GB2312" );
%>
<%=author%>
<div align=
"center"></div>
</td>
<td width=
"32%" align="center"><%=rs.getString("Date")%>
<%
out.println(
"</td></tr>");
cc++;
} while(rs.next());
%>
<%
}
apple.closeConn();
%>
<div align=
"center"></div>

</table>
<%@ include file=
"footer.htm" %>
</body>
</html>

lunzi   2004-11-09 20:37:12 评论:0   阅读:1300   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog