<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="setup.asp"-->
<!--#include file="conn.asp"-->
<%
dim id,rs,hit
id=cstr(request("id"))
if id="" or isnumeric(id)=false then
response.Write("未指定新闻的id号,请经过合法途径访问")
response.End()
end if

%>
<%
sql="update news set hit=hit+1 where id=" & cint(id)
conn.execute sql
set rs=server.createobject("ADODB.recordset")
sql="select * from news where id="&cint(id)
rs.open sql,conn,3,3
if rs.bof or rs.eof then 
response.Write("该新闻不存在")
response.End()
end if
hit=rs("hit")
title=rs("title")
newstime=rs("newstime")
content=rs("content")
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=title%>——<%=site_name%></title>
<link href="style.css" rel="stylesheet" type="text/css" />
<SCRIPT type=text/javascript>
function fontZoom(size)
{
   $('content').style.fontSize=size+'px';
}
</SCRIPT>

<SCRIPT language=JavaScript>
var currentpos,timer;

function initialize()
{
timer=setInterval("scrollwindow()",50);
}
function sc(){
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos != document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
</SCRIPT>
</head>
<body>
<!--#include file="top.asp"-->
<div id="box">
<div id="left">
  <div id="nav4">点击排行</div>
<div id="nav4_content">
<ul>
 <%
 Set rs = Server.CreateObject("ADODB.RecordSet")
rs.open "select top "& index_lanmu_no &" * from news  order by hit desc",conn,1,1
if rs.eof and rs.bof then
response.Write("暂无内容")
else
do while not rs.eof
%>
<li>·<a  href="show.asp?id=<%=rs("id")%>" ><%=rs("title")%></a></li>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
 %>
</ul>
</div>
<div id="nav4">投票调查</div>
<div id="nav4_content">
<script language="javascript" src="vote/votescript.asp?vid=7"></script>
</div>
</div>

<div id="right">
<div id="address">您的位置：本站首页&gt;新闻中心&gt;</div>
<h1><%=title%></h1>
<div id="job">发布时间：<%=newstime%> &nbsp;&nbsp;&nbsp;&nbsp;点击：<%=hit%>&nbsp;&nbsp;&nbsp;&nbsp;字体：【<A 
                  href="javascript:fontZoom(16)">大</A>】【<A 
                  href="javascript:fontZoom(14)">中</A>】【<A 
                  href="javascript:fontZoom(12)">小</A>】</div>
<div id="content">
<%=content%>
</div>
</div>

<%
Set rs2 = server.CreateObject("adodb.recordset")
exec="select * from [Comment] order by id desc", conn,1,1
if rs2.eof and rs2.bof then
response.Write("暂无内容")
else
do while not rs2.eof
%>

<table width="753" height="66" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#8BBFD5">
  <tr>
    <td width="56" align="center" bgcolor="#D9E8F0">昵 称：</td>
    <td width="378" bgcolor="#FFFFFF"><%=rs2("name")%></td>
    <td width="52" align="center" bgcolor="#D9E8F0">来 自：</td>
    <td width="267" bgcolor="#FFFFFF"><%=rs2("ip")%></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#D9E8F0">内 容：</td>
    <td colspan="3" bgcolor="#FFFFFF"><%=rs2("content")%></td>
    </tr>
</table><br>
<%
rs2.movenext
loop
end if
rs2.close
set rs2=nothing
 %>

<table width="409" border="0" align="center" cellpadding="0" cellspacing="0">
<form action="show.asp?add=ok" method="post">
  <tr>
    <td width="62">昵称：</td>
    <td width="347"><input type="text" name="textfield" /></td>
  </tr>
  <tr>
    <td>内容：</td>
    <td><textarea name="textarea" cols="45" rows="5"></textarea></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="发表评论" /></td>
  </tr>
  </form>
</table>
</div>
<!--#include file="bottom.asp"-->
</body>
</html>
<%
If Request.QueryString("add") = "ok" Then
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from Comment"
    rs.Open sql, conn, 1, 3
    name = request.Form("name")
    content = request.Form("content")
    newsid= request.Form("id")
    If name = "" Then
        response.Write("<script language=javascript>alert('昵称不能为空！');history.go(-1)</script>")
        response.End
    End If
    If content = "" Then
        response.Write("<script language=javascript>alert('详细内容不能为空！');history.go(-1)</script>")
        response.End
    End If
    rs.addnew
    rs("name") = name
    rs("content") = content
    rs("newsid") = newsid
    rs.update
    rs.Close
    Set rs = Nothing
    Response.Write "<script language=javascript>alert('添加成功！');window.location.href='news_add.asp';</script>"
End If
%>
<%
conn.close
set conn = nothing
%>