📄 indexnew.asp
字号:
<%
dim indexdot
'indexdot="<FONT color=#b70000> <B>·</B></FONT> "
indexdot=" <img border=0 src='img/c3.gif' align=absmiddle> "
'=================================================
'过程名:index_news
'作 用:首页站点新闻调用
'参 数:num--------------调用条数
' fontnum----------显示文字长度
' classid---------一级分类调用id,0为全部
' classyes--------是否显示分类,True为是,False为否
' NewWindows------是否新窗打开,True为是,False为否
'web: www.ynsky.com.cn
'=================================================
sub index_news(num,fontnum,classid,classyes,NewWindows)
Response.Write "<table border=0 cellspacing=0 cellpadding=0 width='100%'>"
if classid=0 then
sql="select top "&num&" * from news where passed=0 ORDER by news_id DESC"
else
sql="select top "&num&" * from news where passed=0 and (cat_id="&classid&" or cat_id in(select cat_id from newcat where sid="&classid&")) order by news_id DESC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
Response.Write "<font color=""#666666"">目前尚无任何新闻!</font>"
end if
do while not rs.eof
sql="select cat_id,cat_name from newcat where cat_id="&rs("cat_id")
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""
end if
dim uclass
if classyes=True then
uclass="<a href='http://www.ynsky.com.cn/news.asp?cat_id="&rs("cat_id")&"'>["&rscat("cat_name")&"]</a>"
else
uclass=""
end if
Response.Write "<tr><td>"&indexdot&uclass&"<a href='http://www.ynsky.com.cn/shownews.asp?news_id="&rs("news_id")&"' "& nnn &" Title='新闻名称:"&rs("news_title")&"
上传时间:"&rs("news_date")&"
浏览指数:"&rs("news_count")&"'><font color="&rs("news_color")&">"&gotTopic(rs("news_title"),fontnum)&"</font></a>" & vbCrLf
if rs("isimg")=1 then
Response.Write "<img src='img/img.gif' alt='图片新闻' align=absmiddle border=0>" & vbCrLf
end if
if DateDiff("h",rs("news_date"),now())<=24 then
Response.Write "<img src='img/new.gif' alt='24小时内新闻'>" & vbCrLf
end if
Response.Write "</td><td align=right>" & vbCrLf
Response.Write ""&Right("0"&month(rs("news_date")),2)&"-"&right("0"&day(rs("news_date")),2)&"" & vbCrLf
Response.Write "</td></tr>" & vbCrLf
rscat.close
set rscat=nothing
rs.movenext
loop
rs.close
set rs=nothing
Response.Write "</table>"
end sub
'=================================================
'过程名:index_xw
'作 用:首页滚动分类新闻调用
'参 数:num--------------调用条数
' fontnum----------显示文字长度
' cat_id-----------分类ID
'web: www.ynsky.com.cn
'=================================================
sub index_xw(cat_id,num,fontnum)
Response.Write "<div id='Rolls1'>" & vbCrLf
Response.Write "<table cellspacing='0' cellpadding='0' width='400' border='0'>" & vbCrLf
sql="SELECT top "&num&" * FROM news where passed=0 and cat_id="&cat_id&" ORDER BY news_id DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
Response.Write "<tr><td height=20> • <a href='http://www.ynsky.com.cn/shownews.asp?news_id="&rs("news_id")&"' target='_blank' title='"&rs("news_title")&"'><font color=#880000>"&gotTopic(rs("news_title"),fontnum)&"</font></a> "&rs("news_date")&"</td></tr>" & vbCrLf
rs.movenext
loop
if rs.eof and rs.bof then
Response.Write "<font color=""#666666""> 目前尚无此分类新闻!</font>"
end if
rs.close
set rs=nothing
Response.Write "</table>" & vbCrLf
Response.Write "</div>" & vbCrLf
Response.Write "<div id='Rolls2' style=""z-index: 1; visibility: hidden; position: absolute""></div>" & vbCrLf
%>
<script>
marqueesHeight=21;scrillHeight=21;scrillspeed=5;stoptimes=50;stopscroll=false;Rolls1.scrollTop=0;with (Rolls1)
{style.width=0;style.height=marqueesHeight;style.overflowX="visible";style.overflowY="hidden";noWrap=true;onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
preTop=0;
currentTop=0;
stoptime=0;
function initRollsstext()
{ Rolls2.innerHTML="";Rolls2.innerHTML+=Rolls1.innerHTML;Rolls1.innerHTML=Rolls2.innerHTML+Rolls2.innerHTML;setInterval("scrollUp()",scrillspeed);}
function scrollUp()
{if(stopscroll==true) return;
currentTop+=1;if(currentTop==scrillHeight){ stoptime+=1;currentTop-=1;if(stoptime==stoptimes){currentTop=0; stoptime=0; }}
else {preTop=Rolls1.scrollTop;
Rolls1.scrollTop+=1;if(preTop==Rolls1.scrollTop)
{ Rolls1.scrollTop=Rolls2.offsetHeight-marqueesHeight;
Rolls1.scrollTop+=1; }
}}
setInterval("",1000);
initRollsstext();
</script>
<%
end sub
'=================================================
'过程名:FlashNews
'作 用:首页新闻图片FLASH幻灯
'参 数:num--------------调用条数
' fontnum----------显示文字长度
' PicWidthStr--------图片宽度
' PicHeightStr-------图片高度
' BGcolor------------背景色
' txtheight----------文字显示高度,0为不显示
'web: www.ynsky.com.cn
'=================================================
Function FlashNews(num,fontnum,PicWidthStr,PicHeightStr,BGcolor,txtheight)
Dim RsFilterObj,FlashStr,ImagesStr,TxtStr,LinkStr
FilterSql = "SELECT top "&num&" * FROM news where isimg=1 and images<>'' ORDER BY news_id DESC"
Set RsFilterObj = Conn.Execute(FilterSql)
If not RsFilterObj.Eof then
Dim Temp_Num
Temp_Num = 0
Do While Not RsFilterObj.Eof
Temp_Num = Temp_Num + 1
RsFilterObj.MoveNext
Loop
RsFilterObj.MoveFirst
If Temp_Num <=1 then
Set RsFilterObj = Nothing
FlashNews = "至少需要两条幻灯新闻才能正确显示幻灯效果"
Set RsFilterObj = Nothing
Exit Function
End If
do while Not RsFilterObj.Eof
if ImagesStr = "" then
ImagesStr = RsFilterObj("images")
TxtStr = gotTopic(RsFilterObj("news_title"),fontnum)
LinkStr = "shownews.asp?news_id="&RsFilterObj("news_id")
else
ImagesStr = ImagesStr &"|"& RsFilterObj("images")
TxtStr = TxtStr & "|" & gotTopic(RsFilterObj("news_title"),fontnum)
LinkStr = LinkStr & "|" & "shownews.asp?news_id="& RsFilterObj("news_id")
end if
RsFilterObj.MoveNext
loop
FlashStr="<script type=""text/javascript"">"& Chr(13)
FlashStr=FlashStr&"<!--"& Chr(13)
FlashStr=FlashStr&"var focus_width="&PicWidthStr& Chr(13)
FlashStr=FlashStr&"var focus_height="&PicHeightStr& Chr(13)
FlashStr=FlashStr&"var text_height="&txtheight& Chr(13)
FlashStr=FlashStr&"var swf_height = focus_height+text_height"& Chr(13)
FlashStr=FlashStr&"var pics='"&ImagesStr&"'"&Chr(13)
FlashStr=FlashStr&"var links='"&LinkStr &"'"&Chr(13)
FlashStr=FlashStr&"var texts='"&TxtStr&"'"&Chr(13)
FlashStr=FlashStr&"document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"" width=""'+ focus_width +'"" height=""'+ swf_height +'"">');"&Chr(13)
FlashStr=FlashStr&"document.write('<param name=""allowScriptAccess"" value=""sameDomain""><param name=""movie"" value=""img/pic.swf""><param name=""quality"" value=""high""><param name=""bgcolor"" value="&BGcolor&">');"&Chr(13)
FlashStr=FlashStr&"document.write('<param name=""menu"" value=""false""><param name=wmode value=""opaque"">');"&Chr(13)
FlashStr=FlashStr&" document.write('<param name=""FlashVars"" value=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"">');"&Chr(13)
FlashStr=FlashStr&"document.write('<embed src=""img/pic.swf"" wmode=""opaque"" FlashVars=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"" menu=""false"" bgcolor="&BGcolor&" quality=""high"" width=""'+ focus_width +'"" height=""'+ swf_height +'"" allowScriptAccess=""sameDomain"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" />');"&Chr(13)
FlashStr=FlashStr&"document.write('</object>');"&Chr(13)
FlashStr=FlashStr&"//-->"& Chr(13)
FlashStr=FlashStr&"</script>"
else
FlashStr="没有幻灯图片"
end if
RsFilterObj.Close
Set RsFilterObj = Nothing
FlashNews= FlashStr
End Function
'=================================================
'过程名:index_diary
'作 用:首页公告
'参 数:num--------------调用条数
'web: www.ynsky.com.cn
'=================================================
sub index_diary(num)
sql="SELECT top "&num&" d_content,d_date FROM diary Where d_top=0 and (d_class=0 or d_class=1) ORDER BY d_date DESC"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
i=0
do while not rs.eof
i=i+1
if DateDiff("h",rs("d_date"),now())<=48 then Response.Write "<font color=red>"
Response.Write "<div><img src='img/user/sz2-"&i&".gif'> "&rs("d_content")&""
Response.Write "</div><div align=""right"" class=table-xia>["&year(rs("d_date"))&"-"&month(rs("d_date"))&"-"&day(rs("d_date"))&"]</div></font>" & vbCrLf
rs.movenext
loop
if rs.eof and rs.bof then
Response.Write "<font color=""#666666"">目前尚无公告!</font>"
end if
rs.close
set rs=nothing
end sub
'=================================================
'过程名:index_vote
'作 用:首页投票
'参 数:无
'web: www.ynsky.com.cn
'=================================================
sub index_vote()
sql="select top 1 * from votetopic where datediff('d',Now(),vt_expiredate)>0 order by vt_id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then
Response.Write "<script language=""JavaScript"" type=""text/JavaScript"">" & vbCrLf
Response.Write "<!--" & vbCrLf
Response.Write "function MM_openBrWindow(theURL,winName,features) { //v2.0" & vbCrLf
Response.Write " window.open(theURL,winName,features);" & vbCrLf
Response.Write "}" & vbCrLf
Response.Write "//-->" & vbCrLf
Response.Write "</script>" & vbCrLf
Response.Write "<TABLE cellPadding=2 cellspacing=0 width=""100%""><TBODY><form name=""form1"" method=""post"" action=""savevote.asp?vt_id="&rs("vt_id")&"&vt_name="&rs("vt_name")&""" target=""vote"" onsubmit=""return vote()"">" & vbCrLf
Response.Write " <TR>" & vbCrLf
Response.Write " <TD><img src=""img/voteMenu1.gif""> <B>"&rs("vt_name")&"</B></TD>" & vbCrLf
Response.Write " </TR>" & vbCrLf
Response.Write " <TR>" & vbCrLf
Response.Write " <TD>"
sql="select * from voteitem where vt_id="&rs("vt_id")
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof
Response.Write "<input type=""radio"" name=""item_id"" value="""&rs2("item_id")&""">"&rs2("item_name")&" ["&rs2("item_count")&"]<BR>" & vbCrLf
rs2.movenext
loop
if rs2.eof and rs2.bof then
Response.Write "<TABLE cellSpacing=0 cellPadding=0 border=0><TR height=""120""><TD align=middle><font color=""#666666"">当前没有投票选项!</font></TD></TR></TABLE>"
end if
rs2.close
set rs2=nothing
Response.Write "</TD></TR>" & vbCrLf
Response.Write "<TR><TD align=middle>" & vbCrLf
Response.Write "<input name=""itemname"" type=""hidden"" value="""&rs("vt_name")&""">"
if request.cookies("npw")("voted")<>"yes" or request.cookies("npw")("topic")<>rs("vt_name") then
Response.Write "<input name='Submit' type='image' src='img/vote01.gif' width='59' height='19' border='0'>" & vbCrLf
else
Response.Write "<input name='Submit' type='image' disabled src='img/vote01.gif' width='59' height='19' border='0'>" & vbCrLf
end if
Response.Write " <a href=""javascript:;"" onFocus=""if(this.blur)this.blur()"" onClick=""window.open('showvote.asp?vt_id="&rs("vt_id")&"','_blank','menubar=no,toolbar=no,status=no,dependent=yes,scrollbars=no,Width=655,Height=375,top=98,left=72')""><img src='img/vote02.gif' width='59' height='19' border='0'></a>" & vbCrLf
Response.Write "</TD></TR>" & vbCrLf
Response.Write "</FORM></TBODY></TABLE>" & vbCrLf
else
response.write "<TABLE cellSpacing=0 cellPadding=0 border=0><TR height=""160""><TD align=middle><font color=""#666666"">当前没有投票主题!</font></TD></TR></TABLE>" & vbCrLf
end if
rs.close
set rs=nothing
end sub
'=================================================
'过程名:index_pic
'作 用:首页最新图片调用
'参 数:num--------------调用条数
' classid----------分类调用id,0为全部
' picway-----------排列方向,0纵向,1横向
'web: www.ynsky.com.cn-----Hxcms7.6
'=================================================
sub index_pic(num,classid,picway)
Response.Write "<TABLE cellSpacing=5 cellPadding=0 border=0 align='center'>"
if picway=1 then Response.Write "<TR align=middle>" & vbCrLf
if classid=0 then
sql="select top "&num&" * from pic where passed=0 ORDER by pic_id DESC"
else
sql="select top "&num&" * from pic where passed=0 and (piccat_id="&classid&" or piccat_id in(select piccat_id from piccat where sid="&classid&")) order by pic_id DESC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
if picway=0 then Response.Write "<TR align=middle>" & vbCrLf
Response.Write "<TD align='center'><SCRIPT type=text/javascript>hx66img("""&rs("pic_spic")&""",""showpic.asp?pic_id="&rs("pic_id")&""",""图片名称:"&rs("pic_name")&"\n点击次数:"&rs("pic_count")&"\n文件大小:"&rs("pic_url")&"\n上传时间:"&rs("pic_date")&""");</SCRIPT>" & vbCrLf
Response.Write ""&gotTopic(rs("pic_name"),18)&"</TD>"
if picway=0 then Response.Write "</TR>" & vbCrLf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -