联系方式

站长:
联系人:赵先生
手机:18183869808

QQ 64816414
保健茶:

联系人:罗小姐

电话:15368244381

QQ 834856496

function
发布者:zaq 类型:杂器快贴 发布时间:2018-10-13 8:24:12 浏览:3668次 [回复]
<%
function getkeyword()
dim xx,sql1,rs1
sql1="select top 5 distinct name from types where display=1"
sql1="select top 5 name from types where display=1"
set rs1=server.createObject("adodb.recordset")
rs1.Open sql1,conn,1,1
if not(rs1.eof and rs1.bof) then
rs1.movefirst
do while not rs1.eof
if xx="" then
xx=rs1("name")
else
xx=xx & "," & rs1("name")
end if
rs1.movenext
loop
end if
rs1.close
set rs1=nothing

sql1="select top 1 name,hits from doc where pass=1 order by hits desc"
set rs1=server.createObject("adodb.recordset")
rs1.Open sql1,conn,1,1
if not(rs1.eof and rs1.bof) then
rs1.movefirst
do while not rs1.eof
if xx="" then
xx=rs1("name")
else
xx=xx & "," & rs1("name")
end if
rs1.movenext
loop
end if
rs1.close
set rs1=nothing
getkeyword=xx
end function

dim pp,dt
function dir_all(p,s)
dim rs1,k,ss,sql1
'if datediff("n",now,dt)>=60 then exit function
set rs1=server.createObject("adodb.recordset")
sql1="select * from types where in_id=" & p & " order by orders asc"
rs1.Open sql1,conn,1,1
if not(rs1.eof and rs1.bof) then
rs1.movefirst
for k=1 to rs1.RecordCount
if find_father1(rs1("types_id"),rs1("in_id")) then exit for
if k=rs1.RecordCount then
pp=pp & "└"
else
pp=pp & "├"
end if
if len(pp)>1 then
pp=Replace(Replace(left(pp,len(pp)-1),"└"," "),"├","│")+right(pp,1)
end if

if rs1("types_id")=s then
ss=" selected"
else
ss=""
end if

response.write "<option value=" & rs1("types_id") & ss & ">" & pp & rs1("titles") & "</option>"
pp=left(pp,len(pp)-1)

if k=rs1.RecordCount then
pp=pp & "└"
else
pp=pp & "├"
end if
if len(pp)>1 then
pp=Replace(Replace(left(pp,len(pp)-1),"└"," "),"├","│")+right(pp,1)
end if
call dir_all(rs1("types_id"),s)
pp=left(pp,len(pp)-1)

rs1.movenext
next
elseif pp="" then
if p=s then
ss=" selected"
else
ss=""
end if
pp="└"
response.write "<option value=" & p & ss & ">" & pp & getin("types","titles","types_id=" & p) & "</option>"
pp=""
end if
rs1.close
set rs1=nothing
end function

function find_child1(p)
dim rs1,k,sql1
if p="" then exit function
set rs1=server.createObject("adodb.recordset")
sql1="select types_id from types where in_id =" & p & " order by orders asc"
rs1.Open sql1,conn,1,1
if not(rs1.eof and rs1.bof) then
'if rs1.RecordCount>0 then
rs1.movefirst
for k=1 to rs1.RecordCount
'if find_father(rs1("types_id"),rs1("types_id")) then exit for
if trim(pp)="" then
pp=rs1("types_id")
else
pp=pp & "," & rs1("types_id")
end if
find_child1(rs1("types_id"))
rs1.movenext
next
end if
rs1.close
set rs1=nothing
end function

function find_child(p)
pp=""
find_child1(p)
find_child=pp
pp=""
end function

function find_father1(p,s)
dim types
beginerr
if s="0" then
find_father1=false
exit function
end if
types="."& getin("types","types","types_id=" & s) & "."
if instr(types,"."&p&".")>0 then
find_father1=true
else
find_father1=false
end if
enderr
end function

function find_father(p,s)
dim rs1,k,sql1
beginerr
set rs1=server.createObject("adodb.recordset")
sql1="select * from types where in_id=" & p
rs1.Open sql1,conn,1,1
if not(rs1.eof and rs1.bof) then
rs1.movefirst
do while not rs1.eof
if cint(rs1("types_id"))=cint(s) then
find_father=true
exit function
else
find_father=false
end if
'response.write rs1("types_id") & "," & s & "<br>"
if find_father(rs1("types_id"),s) then
find_father=true
end if
rs1.movenext
loop
end if
rs1.close
set rs1=nothing
enderr
end function

sub beginerr
on error resume next
end sub
sub enderr
if err then
response.write ERR.Description
err.clear
end if
end sub
%>
<%sub closewin(s)%>
<script language=javascript>
document.write("<table border=0 align=center valign=center><tr><td>");
document.write("<p align=center>");
document.write("<%=s%>秒钟后自动关闭");
document.write("</p>");
document.write("<p align=center>");
document.write("[<a href=# onclick='window.close();'>关闭窗口</a>]");
document.write("</p></td></tr></table>");
window.setTimeout("window.close()","<%=s%>000");
</script>
<%end sub%>

<%sub backwin(s)%>
<script language=javascript>
document.write("<table border=0 align=center valign=center><tr><td>");
document.write("<p align=center>");
document.write("<%=s%>秒钟后自动返回");
document.write("</p>");
document.write("<p align=center>");
document.write("[<a href=# onclick='window.history.go(-1);'>返回窗口</a>]");
document.write("</p></td></tr></table>");
window.setTimeout("window.history.go(-1)","<%=s%>000");
</script>
<%end sub%>

<%sub backtop(s,msg)%>
<table border="0" height="100%" width="100%">
<tr>
<td align="center" valign="center">
<TABLE border="1" cellSpacing="1" cellPadding="1" width="300" height="150">
<tr height="22" bgcolor="#eeeeee"><td class="shadow" align="center"><b>错误信息</b></td></tr>
<tr bgcolor="#ffffee">
<td align="center" height="100%">
<font color='#ff0000'><%=msg%></font><br><br>
<span id="bs"><%=s%></span>秒钟后自动返回<br><br>
<a class="blu" href="javascript:window.history.go(-1);">[返回窗口]</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
function bTime(s)
{if s-1<=0)
{
document.all.bs.innerText=0;
window.history.go(-1);
return 0;
}
else
{
document.all.bs.innerText=s-1;
return s-1;
}
}
window.setInterval("bTime(document.all.bs.innerText)",1000);
</script>
<%end sub%>
<%sub backtop1(title,s,msg)%>
<table border="0" height="100%" width="100%">
<tr>
<td align="center" valign="center">
<TABLE border="1" cellSpacing="1" cellPadding="1" width="300" height="150">
<tr height="22" bgcolor="#eeeeee"><td class="shadow" align="center"><b><%if trim(title)="" then%>信息提示<%else%><%=title%><%end if%></b></td></tr>
<tr bgcolor="#ffffee">
<td align="center" height="100%">
<font color='#ff0000'><%=msg%></font><br><br>
<span id="bs"><%=s%></span>秒钟后自动返回<br><br>
<a class="blu" href="javascript:window.history.go(-1);">[返回窗口]</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
function bTime(s)
{if(s-1<=0)
{
document.all.bs.innerText=0;
window.history.go(-1);
return 0;
}
else
{
document.all.bs.innerText=s-1;
return s-1;
}
}
window.setInterval("bTime(document.all.bs.innerText)",1000);
</script>
<%end sub%>
<%sub err_msg(title,msg)%>
<table border="0" height="100%" width="100%">
<tr>
<td align="center" valign="center">
<TABLE border="1" cellSpacing="1" cellPadding="1" width="300" height="150">
<tr height="22" bgcolor="#eeeeee"><td class="shadow" align="center"><b><%if trim(title)="" then%>信息提示<%else%><%=title%><%end if%></b></td></tr>
<tr bgcolor="#ffffee">
<td align="center" height="100%">
<font color='#ff0000'><%=msg%></font><br><br>
<a class="blu" href="javascript:window.close();">[关闭窗口]</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%end sub%>

<%sub closeme(s,msg)%>
<table border="0" height="100%" width="100%">
<tr>
<td align="center" valign="center">
<TABLE border="1" cellSpacing="1" cellPadding="1" width="300" height="150">
<tr height="22" bgcolor="#eeeeee"><td class="shadow" align="center"><b>错误信息</b></td></tr>
<tr bgcolor="#ffffee">
<td align="center" height="100%">
<font color='#ff0000'><%=msg%></font><br><br>
<span id="cs"><%=s%></span>秒钟后自动关闭<br><br>
<a class="blu" href="javascript:window.close();">[关闭窗口]</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
function cTime(s)
{if(s-1<=0)
{
document.all.cs.innerText=0;
window.close();
return 0;
}
else
{
document.all.cs.innerText=s-1;
return s-1;
}
}
window.setInterval("cTime(document.all.cs.innerText)",1000);
</script>
<%end sub%>
<%sub closeme1(title,s,msg)%>
<table border="0" height="100%" width="100%">
<tr>
<td align="center" valign="center">
<TABLE border="1" cellSpacing="1" cellPadding="1" width="300" height="150">
<tr height="22" bgcolor="#eeeeee"><td class="shadow" align="center"><b><%if trim(title)="" then%>信息提示<%else%><%=title%><%end if%></b></td></tr>
<tr bgcolor="#ffffee">
<td align="center" height="100%">
<font color='#ff0000'><%=msg%></font><br><br>
<span id="cs"><%=s%></span>秒钟后自动关闭<br><br>
<a class="blu" href="javascript:window.close();">[关闭窗口]</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
function cTime(s)
{if(s-1<=0)
{
document.all.cs.innerText=0;
window.close();
return 0;
}
else
{
document.all.cs.innerText=s-1;
return s-1;
}
}
window.setInterval("cTime(document.all.cs.innerText)",1000);
</script>
<%end sub%>
<%
'================
'找节点的父路径
'================
function find_path(p)
dim cp,paths
if trim(p)="" then find_path="":exit function
cp=split(p,".")
for j=0 to ubound(cp)
if j=0 then
paths="<a href=?types_id=" & cp(j) &">" & getin("types","titles","types_id=" & cp(j)) & "</a>"
else
paths=paths&">"&"<a href=?types_id=" & cp(j) &">" & getin("types","titles","types_id=" & cp(j)) & "</a>"
end if
next
'response.write paths
find_path=paths&"--------"
end function

function find_top(xx)'找根节点
beginerr
if trim(xx)="" then exit function
if getin("types","in_id","types_id=" & xx)<>"0" then
find_top=find_top(getin("types","in_id","types_id=" & xx))
else
find_top=xx
exit function
end if
enderr
end function

function find_class(xx)'找根节点级别
beginerr
if trim(xx)="" then exit function
if getin("types","in_id","types_id=" & xx)<>"0" then
find_class=find_class(getin("types","in_id","types_id=" & xx)) & "," & xx
else
find_class=xx
exit function
end if
enderr
end function

function find_class1(xx)'找根节点级别
beginerr
if trim(xx)="" then find_class1="":exit function
find_class1=getin("types","types","types_id=" & xx)
enderr
end function

function add_space(xx)'添加空格
beginerr
dim spaces
if trim(xx)="" then exit function
spaces=""
for i=1 to ubound(split(xx,"."))
spaces=spaces & "&nbsp;&nbsp;"
next
add_space=spaces
enderr
end function

function addspace(name)
dim str,k
if trim(name)="" then exit function
str=""
name=trim(name)
for k=1 to len(name)
str=str & "&nbsp;" & mid(name,k,1)
next
addspace=str
end function

Function getcode1()
On Error Resume Next
If Err<>0 Then
Dim zNum
Randomize timer
zNum = cint(8999*Rnd+1000)
Session("GetCode") = zNum
getcode1= Session("GetCode")
Else
getcode1= "<img src=""getcode.asp"">"
End If
End Function
%>
<%sub showinfo(title,s,msg,info)%>
<table border="0" height="100%" width="100%">
<tr>
<td align="center" valign="center">
<TABLE border="1" cellSpacing="0" cellPadding="0" width="300" height="150">
<tr height="22" bgcolor="#eeeeee"><td class="shadow" align="center">=<%if trim(title)="" then%>信息提示<%else%><%=title%><%end if%>=</td></tr>
<tr bgcolor="#ffffee">
<td align="center" height="100%">
<font color='#ff0000'><%=msg%></font><br><br>
<%if trim(info)="" or trim("info")="0" then%>
<a class="blu" href="javascript:window.close();">[关闭窗口]</a>
<%elseif trim(info)="1" then%>
<span id="cs"><%=s%></span>秒钟后自动返回<br><br>
<a class="blu" href="javascript:window.history.go(-1);">[返回窗口]</a>
<%elseif trim(info)="2" then%>
<span id="cs"><%=s%></span>秒钟后自动关闭<br><br>
<%elseif trim(info)="3" then%>
<a class="blu" href="javascript:window.history.go(-1);">[返回窗口]</a>
<%elseif trim(info)="4" then%>
<a class="blu" href="javascript:window.history.go(-1);">[返回窗口]</a>
&nbsp;&nbsp;<a class="blu" href="javascript:window.close();">[关闭窗口]</a>
<%else%>
<a class="blu" href="javascript:window.close();">[关闭窗口]</a>
<%end if%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language="javascript">
var autotime
function cTime(s)
{if(s-1<=0)
{
document.all.cs.innerText=0;
<%if trim(info)="1" then%>
clearInterval(autotime);
window.history.go(-1);
return 0;
<%elseif trim(info)="2" then%>
clearInterval(autotime);
window.close();
return 0;
<%else%>
clearInterval(autotime);
return 0;
<%end if%>
}
else
{
document.all.cs.innerText=s-1;
return s-1;
}
}
autotime=window.setInterval("cTime(document.all.cs.innerText)","1000");
</script>
<%end sub%>

<%
''''''处理文字与字母的长度问题
function ischinese(s,l,x)
's处理的字符串
'截取的字符串长度,1个汉字=2个字母
'计算所取字符串的长度
if trim(s)="" then exit function
if trim(x)="" then x=0
dim k
for k=1 to l
if l>len(s) then exit for
if Len(Hex(Asc(mid(s,k,1))))<=2 Then
l=l+1
end if
next
if l<Len(s) then
ischinese=left(s,l-x)&"..."
else
ischinese=s
end if
end function
%>

源地址:http://www.zaqi.net/word_view.asp?files_id=438
上一篇:Line是做图中最常用的两个特殊属性
下一篇:瀑布模型、渐增模型/演化/迭代/原型模型/螺旋模型
杂器网络版权所有  免责声明