javascript|vbscript|顯示|字串
ASP VBScript + Javascript 以字串方式二級聯顯示檔案夾 作用: 列出當前設定目錄中的子檔案夾, 再列出子檔案夾的下級檔案夾, 當改變一級子檔案夾的時候, 動態顯示隸屬於其的子檔案夾. 注: Javascript 以字串方法判斷級聯對象, 也就是一級子檔案夾的名字. //並且在頁面載入的時候以一級子檔案夾選擇的目標關聯顯示二級列表框中的內容. shawl.qiu 2006-7-28
ASP VBScript + Javascript 以字串方式二級聯顯示檔案夾
作用: 列出當前設定目錄中的子檔案夾, 再列出子檔案夾的下級檔案夾, 當改變一級子檔案夾的時候, 動態顯示隸屬於其的子檔案夾.
注: Javascript 以字串方法判斷級聯對象, 也就是一級子檔案夾的名字.
//並且在頁面載入的時候以一級子檔案夾選擇的目標關聯顯示二級列表框中的內容.
shawl.qiu
2006-7-28
linenum
<%@LANGUAGE="VBSCRIPT"%>
<% option explicit
dim path:path="include/system/themes/"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' 列出某檔案夾中的一級子檔案夾, 並加上 <option></option>
' call sGetSubfolderNameAtchOpt("include/managemain/language",sitefgstyle)
private sub sGetSubfolderNameAtchOpt(byref Path,check)
dim fso, gFolder, folder, i, fldNm
set fso=server.CreateObject("scripting.fileSystemObject")
set gFolder=fso.getFolder(server.MapPath(path))
for each folder in gFolder.subfolders
fldNm=folder.name
if check=folder.name then response.write "<option selected=""selected"" value="""&_
fldNm& """>" else response.write "<option value="""&fldNm&""">"
response.write fldNm
response.write "</option>"
next
set gFolder=nothing
set fso=nothing
end sub %>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<script>
var subcat;subcat = new Array(); //定義顯示子類數組
<% dim fso, gFolder, varCnt, spFld, sbFld
set fso=server.CreateObject("scripting.fileSystemObject")
set gFolder=fso.getFolder(server.MapPath(path))
varCnt=0
for each spFld in gFolder.subfolders
for each sbFld in spFld.subfolders%>
subcat[<%response.write varCnt%>] = new Array("<%response.write trim(sbFld.name)%>","<%response.write trim(spFld.name)%>");
<% varCnt=varCnt+1
next
next
set gFolder=nothing
set fso=nothing %>
varCnt=<%response.write varCnt%>
function fChangeLoct(pathValue) {
document.all.sbFld.length = 0;
var pathValue=pathValue,i
for (i=0;i < varCnt; i++) {
if (subcat[i][1] == pathValue) {
document.all.sbFld.options[document.all.sbFld.length] = new Option(subcat[i][0], subcat[i][0]);
}
}
}
</script>
<body >
<form action="" method="post" name="formT" id="formT">
<select name="spFld" >
<% call sGetSubfolderNameAtchOpt(path,"schinese") %>
</select><br />
<select name="sbFld"></select>
</form>
</body>
</html>