ASP VBScript + Javascript 以字串方式二級聯顯示檔案夾

來源:互聯網
上載者:User
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>

 



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.