📄 write_js.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="function.asp"-->
<!--#include file="char.inc"-->
<%WriteJsSearchBar()%>
<%WriteJsTypeMenu()%>
<%WriteJsBaseMenu()%>
<%WriteJsBottomMenu()%>
<%WriteJsHotNews()%>
<%WriteJsAboutNews(234)%>
<%
'****************************************************************************
'' @功能说明: 生成项部自定义菜单条js文件
'' @参数说明: -
'' @返回值: -
'****************************************************************************
function WriteJsBaseMenu()
ServePath=server.mappath("js/")
Set fso=Server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(ServePath) then
'检查有没有JS目录,无则自动建立
else
Set f = fso.CreateFolder(ServePath)
set f=nothing
End if
set hf=fso.CreateTextFile(Server.mappath("js/Show_BaseMenu.js"),true)
hf.write "document.writeln("& chr(34) & BaseMenu & chr(34) &");"& vbcrlf
hf.close
set hf=nothing
set fso=nothing
end function
%>
<%
'****************************************************************************
'' @功能说明: 生成底部自定义菜单条js文件
'' @参数说明: -
'' @返回值: -
'****************************************************************************
function WriteJsBottomMenu()
ServePath=server.mappath("js/")
Set fso=Server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(ServePath) then
'检查有没有JS目录,无则自动建立
else
Set f = fso.CreateFolder(ServePath)
set f=nothing
End if
set hf=fso.CreateTextFile(Server.mappath("js/Show_BottomMenu.js"),true)
hf.write "document.writeln("& chr(34) & BottomMenu & chr(34) &");"& vbcrlf
hf.close
set hf=nothing
set fso=nothing
end function
%>
<%
'****************************************************************************
'' @功能说明: 生成Search搜索条的js文件
'' @参数说明: -
'' @返回值: -
'****************************************************************************
function WriteJsSearchBar()
ServePath=server.mappath("js/")
Set fso=Server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(ServePath) then
'检查有没有JS目录,无则自动建立
else
Set f = fso.CreateFolder(ServePath)
set f=nothing
End if
set hf=fso.CreateTextFile(Server.mappath("js/Show_SearchBar.js"),true)
hf.write "document.writeln("& chr(34) &"<TABLE cellSpacing=0 cellPadding=0 border=0><TBODY><form method=post name=myform action=Result.asp target=newwindow><TR><TD class=top>"& chr(34) &");"& vbcrlf
if showsearch=1 then
if search="1" then
hf.write "document.writeln("& chr(34) &"<select name=action style='border:1 solid #CCD5F9; font-size:9pt; background-color:#EAEAF4' size=1>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<option selected value=''>全部内容</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<option value='title'>按标题</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<option value='content'>按内容</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<option value='editor'>按作者</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<option value='about'>按关键字</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"</select>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<input type='text' name='keyword' size=10 value='关键字' style='font-size:9pt; background-color:#EAEAF4' onfocus=\"& chr(34) &"if (value =='关键字'){value =''}\"& chr(34) &" onblur=\"& chr(34) &"if (value ==''){value='关键字'}\"& chr(34) &" maxlength='50'>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<input type='submit' name='Submit' value='搜索'>"& chr(34) &");"& vbcrlf
else
dim count
set rs7=server.createobject("adodb.recordset")
rs7.Source= "select * from "& db_SmallClass_Table &" order by SmallClassID asc"
rs7.open rs7.Source,conn,1,1
hf.write "var onecount;"& vbcrlf
hf.write "onecount=0;"& vbcrlf
hf.write "subcat = new Array();"& vbcrlf
count = 0
do while not rs7.eof
hf.write "subcat["& count &"] = new Array("& chr(34) &""& rs7("SmallClassName") &""& chr(34) &","& chr(34) &""& rs7("BigClassid") &""& chr(34) &","& chr(34) &""& rs7("SmallClassID") &""& chr(34) &");"& vbcrlf
count = count + 1
rs7.movenext
loop
rs7.close
set rs7=nothing
hf.write "onecount="& count &";"& vbcrlf
hf.write "function changelocation(locationid)"& vbcrlf
hf.write " {"& vbcrlf
hf.write " document.myform.SmallClassID.length = 0; "& vbcrlf
hf.write " var locationid=locationid;"& vbcrlf
hf.write " var i;"& vbcrlf
hf.write " for (i=0;i < onecount; i++)"& vbcrlf
hf.write " {"& vbcrlf
hf.write " if (subcat[i][1] == locationid)"& vbcrlf
hf.write " { "& vbcrlf
hf.write " document.myform.SmallClassID.options[document.myform.SmallClassID.length] = new Option(subcat[i][0], subcat[i][2]);"& vbcrlf
hf.write " }"& vbcrlf
hf.write " }"& vbcrlf
hf.write " }"& vbcrlf
hf.write "document.writeln("& chr(34) &"<select name='action' style='border:1 solid #CCD5F9; font-size:9pt; background-color:#EAEAF4' size='1'>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &" <option selected value=''>全部内容</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &" <option value='title'>按标题</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &" <option value='content'>按内容</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &" <option value='editor'>按作者</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &" <option value='about'>按关键字</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"</select>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<select name='BigClassid' onChange='changelocation(document.myform.BigClassid.options[document.myform.BigClassid.selectedIndex].value)' style='border:1 solid #CCD5F9; font-size:9pt; background-color:#EAEAF4' size='1'>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &" <option selected value=''>全部大类</option>"& chr(34) &");"& vbcrlf
set rs8=server.CreateObject("ADODB.RecordSet")
rs8.Source="select * from "& db_BigClass_Table &" order by BigClassID"
rs8.Open rs8.Source,conn,1,1
do while not rs8.eof
hf.write "document.writeln("& chr(34) &" <option value='"& rs8("BigClassid") &"'>"& rs8("BigclassName") &"</option>"& chr(34) &");"& vbcrlf
rs8.movenext
loop
rs8.close
set rs8=nothing
hf.write "document.writeln("& chr(34) &"</select>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<select name='SmallClassID' style='border:1 solid #CCD5F9; font-size:9pt; background-color:#EAEAF4' size='1' >"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &" <option selected value=''>全部小类</option>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"</select>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<input type='text' name='keyword' style='font-size:9pt; background-color:#EAEAF4' size=10 value='关键字' onfocus=\"& chr(34) &"if (value =='关键字'){value =''}\"& chr(34) &" onblur=\"& chr(34) &"if (value ==''){value='关键字'}\"& chr(34) &" maxlength='50'>"& chr(34) &");"& vbcrlf
hf.write "document.writeln("& chr(34) &"<input type='submit' name='Submit' value='搜索' style='font-size: 9pt; color: #000000; background-color: #EAEAF4; solid #EAEAF4'>"& chr(34) &");"& vbcrlf
end if
end if
hf.write "document.writeln("& chr(34) &"</TD></TR></form></TBODY></TABLE>"& chr(34) &");"& vbcrlf
hf.close
set hf=nothing
set fso=nothing
end function
%>
<%
'****************************************************************************
'' @功能说明: 生成TypeMenu菜单条的js文件
'' @参数说明: -
'' @返回值: -
'****************************************************************************
function WriteJsTypeMenu()
ServePath=server.mappath("js/")
Set fso=Server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(ServePath) then
'检查有没有JS目录,无则自动建立
else
Set f = fso.CreateFolder(ServePath)
set f=nothing
End if
set hf=fso.CreateTextFile(Server.mappath("js/Show_TypeMenu2.js"),true)
'if B_BG=0 then '判断菜单是否二级显示
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select * from type order by typeorder"
rs.Open rs.Source,conn,1,1
i=1
while not rs.EOF
RecordCount=rs.RecordCount
menuid=rs("typeid")
menuname=rs("typename")
menucontent=rs("typecontent")
menuview=rs("typeview")
hf.write "mpmenu"& menuid &"=new mMenu('<font color=FFFFFF>| "& menuName &"</font>','"& xpurl &"type.asp?typeID="& menuid &"','self','','','','');"& vbcrlf
set rs1=server.CreateObject("ADODB.RecordSet")
set rs1=conn.execute("SELECT * FROM bigclass where typeid="& menuid &" order by bigclassorder")
do while not rs1.eof
hf.write "mpmenu"& menuid &".addItem(new mMenuItem('<img src="& xpurl &"images/Menu_x.gif> "& Rs1("bigclassname") &"','"& xpurl &"bigclass.asp?typeid="& menuid &"&bigclassid="& Rs1("bigclassid") &"','self',false,'"& Rs1("bigclassname") &"',null,'','','',''));"& vbcrlf
rs1.movenext
loop
rs1.close
i=i+1
rs.MoveNext
wend
rs.close
set rs=nothing
hf.write "mwritetodocument();"& vbcrlf
hf.close
set hf=nothing
set hf=fso.CreateTextFile(Server.mappath("js/Show_TypeMenu1.js"),true)
'else
sqltype="select * from "& db_Type_Table & " order by typeorder" '选择分类
Set rstype= Server.CreateObject("ADODB.Recordset")
rstype.open sqltype,conn,1,1
dim Type_i,strtype
Type_i=1
typeNum=rstype.recordcount
strtype= "document.writeln("& chr(34) &"<span style=' height:9px;color=#FFFFFF'>|</span>"& chr(34) &");"& vbcrlf
if rstype.bof and rstype.eof then
strtype = strtype & "栏目正在建设中| "
else
rstype.movefirst
do while not rstype.eof
'菜单条(大类)
strtype = strtype & "document.writeln("& chr(34) &"<span style=' height:9px; color=#FFFFFF'><a class=MenuType href='"& xpurl &"Type.asp?TypeId="& rstype("typeid") &"' id=menu"& Type_i &" title='"& rstype("typecontent") &"'>"& rstype("typeName") &"</a> |</span>"& chr(34) &");"& vbcrlf
rstype.movenext
Type_i=Type_i+1
loop
end if
hf.write strtype
'end if
hf.close
set hf=nothing
set fso=nothing
end function
%>
<%
'****************************************************************************
'' @功能说明: 生成热门文章js文件
'' @参数说明: -
'' @返回值: -
'****************************************************************************
function WriteJsHotNews()
ServePath=server.mappath("js/")
Set fso=Server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(ServePath) then
'检查有没有JS目录,无则自动建立
else
Set f = fso.CreateFolder(ServePath)
set f=nothing
End if
set hf=fso.CreateTextFile(Server.mappath("js/Show_HotNews.js"),true)
hf.write "document.writeln("& chr(34) &"<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='98%' id='AutoNumber5'>"& chr(34) &");"& vbcrlf
dim ii
ii = 0
set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select top " & top_txt & " * from "& db_News_Table &" where checkked=1 order by click DESC"
rs.Open rs.Source,conn,1,1
if rs.bof and rs.eof then
hf.write "document.writeln("& chr(34) &"<td align=center><br>暂 无<br><br></td>"& chr(34) &");"& vbcrlf
else
do while not rs.eof
hf.write "document.writeln("& chr(34) &"<tr><td height=12> · "& chr(34) &");"& vbcrlf
if rs("picnews")=1 then
hf.write "document.writeln("& chr(34) &"<img src='images/news_img.gif'>"& chr(34) &");"& vbcrlf
end if
HtmlFileName=rs("HTMLFileName")
if UCase(HTMLFileName)<>"NO" and HTMLFileName<>"" then
hf.write "document.writeln("& chr(34) &"<a class=middle href='"& xpurl & HtmlFileName &"' title='"& htmlencode4(rs("title")) &"'>"& CutStr(htmlencode4(rs("title")),14) &"</a>"& chr(34) &");"& vbcrlf
else
hf.write "document.writeln("& chr(34) &"<a class=middle href='Article.asp?NewsID="& rs("NewsID") &"' title='"& htmlencode4(rs("title")) &"'>"& CutStr(htmlencode4(rs("title")),14) &"</a>"& chr(34) &");"& vbcrlf
end if
hf.write "document.writeln("& chr(34) &"</td></tr>"& chr(34) &");"& vbcrlf
ii =ii + 1
if ii>top_txt-1 then exit do
rs.movenext
loop
end if
rs.close
set rs=nothing
hf.write "document.writeln("& chr(34) &"</table>"& chr(34) &");"& vbcrlf
hf.close
set hf=nothing
set fso=nothing
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -