change()要怎么改?

Jeroki 2002-07-02 03:53:50
function change(){
if(!document.all)
return
if (event.srcElement.id=="foldheader") {
var srcIndex = event.srcElement.sourceIndex
var nested = document.all[srcIndex+1]
if (nested.style.display=="none") {
nested.style.display=''
event.srcElement.style.listStyleImage="url(img/open.gif)"
}
else {
nested.style.display="none"
event.srcElement.style.listStyleImage="url(img/fold.gif)"
}
}
}

document.onclick=change

//-->
</script>
<% sqlstr="SELECT distinct classname FROM leibie "
set rs=conn.execute(sqlstr) %>

<% do while not rs.eof %>
<li id=foldheader>
<%=rs("classname")%><%cl=rs("classname")%> //怎樣將CL的數值傳遞給下面的classs(上面的change()要怎么改?)
<ul id=foldinglist style="DISPLAY: none">
<% sqlstr="SELECT classs FROM leibie where classs='"&cl&"' "//我要把CL傳到這里來!(當我點激樹型菜單時只彈出几行空白,根本就沒彈出classs的值.我把where條件去掉,所有的classs值全部彈出.這不是我要的效果.)
set rs4=conn.execute(sqlstr) %>
<% do while not rs4.eof %>

<li><a href="<%=rs4("classs")%>.html"><%=rs4("classs")%></a>

<% rs4.movenext
loop
%>
</ul>
<%rs.movenext
loop
%>
...全文
50 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jeroki 2002-07-03
  • 打赏
  • 举报
回复
對頭!我就是要做层叠的树型!不過是動態的!(參數全部來自數據庫)
純粹定義幾個參數是好做!
S.F. 2002-07-03
  • 打赏
  • 举报
回复
看这段代码;直接运行后即可看到效果

<%@ LANGUAGE = VBScript %>
<%Server.ScriptTimeout=5000
Response.Buffer = True
%>
<html>

<head>
<style TYPE="text/css">
LI {font-size:12px;white-space: nowrap}
UL UL {display: none;
font-size:12px;
cursor:hand;
}
a { font-size: 9pt; color: #000000; text-decoration: none}
a:hover { color: blue; text-decoration: underline; font-size: 9pt}
body { font-size: 12px }
</style>
<script LANGUAGE="JavaScript">

function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function checkParent(src, dest) {
while (src!=null) {
if (src.tagName == dest) return src;
src = src.parentElement;
}
return null;
}
function outline() {
var open = event.srcElement;
var el = checkParent(open, "LI");

if (null!=el) {
var pos = 0;
for (var pos=0; pos<el.children.length; pos++) {
if ("UL"==el.children[pos].tagName) break;
}
if (pos==el.children.length) return;
} else return;

el = el.children[pos];
if ("UL"==el.tagName) {
if (""==el.style.display) {
el.style.display = "block";
el.style.listStyleImage = "url(images/pclosed.gif)";
el.parentElement.style.listStyleImage = "url(images/popen.gif)";
}else{
el.style.display = "";
el.parentElement.style.listStyleImage = "url(images/pclosed.gif)";
}
}

event.cancelBubble = true;
}
function showTip(){if ((obj=MM_findObj('loadstate'))!=null) obj.style.visibility = 'visible';} //设置其显示
function hideTip(){if ((obj=MM_findObj('loadstate'))!=null) obj.style.visibility = 'hidden';} //隐藏显示

window.onload = showTip;
document.onmouseover = hideTip;
document.onclick = outline;

</script>

<base target="main">
<title>文件目录</title>
</head>

<body link="#000000" vlink="#808080" topmargin="0" leftmargin="0" style="font-size: 12px">
<div id="loadstate" style="position:absolute; left:10px; top:0px;visibility: visible">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#000000" style="font-size:12px">
<tr>
<td width="100%" bgcolor="#FFFFCC">请稍后..正在加载目录</td>
</tr>
</table></div>
<%
response.Flush
%>
<br>
<SCRIPT LANGUAGE=vbscript RUNAT = Server>
Dim fs, folderpara, folderArray
Set fs = CreateObject("Scripting.FileSystemObject")
folderpara = "f:\Mp3\MusicData"
Response.write "<UL>"
Response.write "<LI STYLE='list-style-image: url(images/pclosed.gif)'><a href='/webedit/Index2.asp' target='_top'>共享软件库</a></LI>"
Response.write "<LI STYLE='list-style-image: url(images/pclosed.gif)'><a href='/video/main.htm' target='_top'>电影库</a></LI>"
Response.write "<LI STYLE='list-style-image: url(images/pclosed.gif)'><a href='playm3u.asp?sPath=" & folderpara & "'>音乐库</a></LI>"
Call ShowFolderList(folderpara)
Response.write "</UL>"

set fs = Nothing

Sub ShowFolderList(folderspec)
Dim f, f1, fc, s
On error resume next
Set f = fs.GetFolder(folderspec)
Set fc = f.SubFolders

if (not (fc.count = 0)) then
Response.write "<UL>"
For Each f1 in fc
If err.Number<>0 Then
Response.Write "<li>" & Err.description & "</li></UL>"
Err.Clear
Exit Sub
end if
s = f1.name
If (not ((left (s, 1)) = "_")) then
Response.write "<li>"
Response.write "<a href='playm3u.asp?sPath=" & f1 & "'>  "
Response.write s & "</LI>"
Response.write "</a>"
Call ShowFolderList((folderspec & "/" & s))
end if
Next
Response.write "</UL>"
end if
end sub
</SCRIPT>
</body>
</html>
<%
response.Flush
%>
S.F. 2002-07-03
  • 打赏
  • 举报
回复
你这是在做什么?做支持层叠的树型吗??

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧