麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > HTA > 正文

hta實現的笨狼樹狀節點查看器

2020-01-31 15:42:39
字體:
來源:轉載
供稿:網友
<html>
<head>
<style>
table
{
    border-collapse: collapse;
    border-width: 4; 
    border-style: double; 
    border-color:#15336F;
    font-size:12px;
}
body
{
    font-size:12px;
}
div
{
    width:100%;
    height:9; 
    border-style:solid; 
    border-width:1; 
    border-color:#eeeeee;    
    vertical-align:top;
    font-size:12;
    cursor:hand;
}
</style>
<title>笨狼樹狀節點查看器</title>
</head>
<body>
 <INPUT type="file" id=file1 name=file1>請輸入xml文件路徑
 <INPUT type="button" value="確定" onclick = "vbs:analyse ">
 <SELECT id="select1" onchange="vbs:analyse">
        <OPTION value="nodeName" >顯示標簽</OPTION>
        <OPTION  value="text" >顯示文字</OPTION>
        <OPTION  value="attribute" >顯示屬性</OPTION>

        <OPTION  value="XPath" >顯示XPath</OPTION>
</SELECT>
<DIV id="oList" style="padding-left:0"></DIV>

</body>
 <script language="vbScript" >
    '**************************************
    '****作者:    超級大笨狼 superdullwolf****
    '**************************************        

        public dic,favour,anything    ,doc      

        set doc = CreateObject("Microsoft.XMLDOM")        
        doc.async=False
    sub analyse()
            dim myTR 
            favour = select1.value
            removeDIV  
            if not doc.load(file1.value) then 
                alert "文件加載失敗,請檢查文件是否存在!"    
            else
                Set rootNode = doc.DocumentElement
                set rootDIV = document.createElement("DIV")    
                rootDIV.setAttribute "XPath",rootNode.nodeName 
                oList.setAttribute "XPath",rootNode.nodeName                  
                oList.setAttribute "parsed",false
                appendDIV     oList,rootNode    

            end if
    end sub

    sub appendDIV(myDIV,myNode)    

        dim myChild    ,newDIV,ChildID,thisID ,ChildXPath

        
        for each myChild in myNode.childNodes

            if     myChild.nodeName <> "#text"    then    
                set newDIV = document.createElement("DIV")            
                myDIV.appendChild    newDIV            
                addPx newDIV, myDIV,10    '縮進10象素

                ChildID = 0
                ChildXPath = myDIV.getAttribute("XPath") & "/" & myChild.nodeName & "[" & ChildID & "]"    

                do while not doc.selectSingleNode(ChildXPath) is myChild
                    ChildID=ChildID+1
                    ChildXPath = myDIV.getAttribute("XPath") & "/" & myChild.nodeName & "[" & ChildID & "]"    
                loop

                newDIV.setAttribute "XPath",ChildXPath 
                newDIV.setAttribute "parsed",false    '子元素還沒標記過了。

                newDIV.title = newDIV.getAttribute("XPath") 
                newDIV.innerText = getText(myChild,newDIV) 

                if myChild.childNodes.length>0 then 

                        newDIV.attachEvent "onclick",GetRef("attachOnclick")
                end if
            end if                     
        next
        myDIV.setAttribute "parsed",true'所有子元素都標記過了。
    end sub    





    sub removeDIV()             
        dim oldDIV
        for each  oldDIV in   oList.childNodes          
               oldDIV.removeNode(true)             
         next     
    end sub

    sub attachOnclick()
        dim obj    ,nodeXPath,cDIV
        set obj=window.event.srcElement 
        nodeXPath = obj.getAttribute("XPath")
        if instr(nodeXPath,"#text") >0 then 
            window.event.cancelBubble = true
            exit sub
        end if
        if not obj.getAttribute("parsed")= true then     
             appendDIV obj ,doc.selectSingleNode(nodeXPath)
        else
            for each cDIV in obj.children
                if cDIV.style.display = "none" then
                    cDIV.style.display = ""
                else
                    cDIV.style.display = "none"
                end if
            next
        end if
        window.event.cancelBubble = true         
    end sub

    function getText(myNode,oDIV)
        dim myAttribute
        getText = ""
        select case favour
            case "text"
                if not isnull(myNode.text) then
                    getText = myNode.text
                 else
                    getText = "空文字"
                 end if            
            case "nodeName"                 
                    getText = myNode.nodeName    
            case "attribute"    
                if myNode.nodeName <>"#text" then
                    for each myAttribute in  myNode.attributes                         
                        getText =getText &  myAttribute.name
                        getText = getText & "=" & chr(34) 
                        getText = getText & myAttribute.value  & chr(34) & " "
                    next
                    getText = trim(getText)
                end if

             
            case "XPath"
                getText = oDIV.title
        end select
        if trim(getText) ="" then getText ="空"
    end function

    sub addPx(newDIV,oldDIV,num)
        dim re,myString    
        set re = new RegExp
        re.Global = true
        re.Pattern = "[^/d]*"            
        myString =  re.Replace(oldDIV.style.paddingLeft, "")
        if myString ="" then myString = "0"
        myString = (cint(myString) + num ) & "px"
        newDIV.style.paddingLeft = myString
        set re = nothing
    end sub
 </script>
</html>
XMLTool.hta
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 日本在线观看中文字幕 | 欧美毛片在线观看 | 天天鲁在线视频免费观看 | 国产xxxxx在线观看 | 日韩a毛片免费观看 | 一级毛片在线观看视频 | 免费观看视频在线观看 | 欧美一级黄色网 | 2021免费日韩视频网 | 色婷婷a v | 福利在线小视频 | 毛片毛片 | 性猛交ⅹxxx乱巴西 欧美日韩1区2区3区 | 午夜视频在线免费 | 亚洲片在线 | 欧美视频99 | 久久99精品久久久久久秒播放器 | 被啪羞羞视频在线观看 | 成人毛片100免费观看 | 成人店女老板视频在线看 | 黄色一级片免费观看 | 特级黄一级播放 | 国产亚洲精品久久久久5区 综合激情网 | 亚洲日韩中文字幕一区 | 久久精品日产第一区二区三区 | 国产精品视频 | 青草久久网 | 中国免费一级毛片 | 国产美女视频黄a视频免费 日韩黄色在线播放 | 亚洲91网 | 国产三级午夜理伦三级 | 亚洲国产成人一区 | 中文在线观看视频 | 欧美一级毛片特黄黄 | 日本s级毛片免费观看 | 中文字幕欧美亚洲 | 黄色片网站在线免费观看 | 精品国产一区二区亚洲人成毛片 | 成人精品久久 | 日韩视频在线不卡 | 成人午夜一区二区 |