hta实现的笨狼树状节点查看器

2023-12-05 0 813

<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> <INPUTtype=\”file\”id=file1name=file1>请输入xml文件路径 <INPUTtype=\”button\”value=\”确定\”onclick=\”vbs:analyse\”> <SELECTid=\”select1\”onchange=\”vbs:analyse\”> <OPTIONvalue=\”nodeName\”>显示标签</OPTION> <OPTIONvalue=\”text\”>显示文字</OPTION> <OPTIONvalue=\”attribute\”>显示属性</OPTION> <OPTIONvalue=\”XPath\”>显示XPath</OPTION> </SELECT> <DIVid=\”oList\”style=\”padding-left:0\”></DIV> </body> <scriptlanguage=\”vbScript\”> \’************************************** \’****作者:超级大笨狼superdullwolf**** \’************************************** publicdic,favour,anything,doc setdoc=CreateObject(\”Microsoft.XMLDOM\”) doc.async=False subanalyse() dimmyTR favour=select1.value removeDIV ifnotdoc.load(file1.value)then alert\”文件加载失败,请检查文件是否存在!\” else SetrootNode=doc.DocumentElement setrootDIV=document.createElement(\”DIV\”) rootDIV.setAttribute\”XPath\”,rootNode.nodeName oList.setAttribute\”XPath\”,rootNode.nodeName oList.setAttribute\”parsed\”,false appendDIVoList,rootNode endif endsub subappendDIV(myDIV,myNode) dimmyChild,newDIV,ChildID,thisID,ChildXPath foreachmyChildinmyNode.childNodes ifmyChild.nodeName<>\”#text\”then setnewDIV=document.createElement(\”DIV\”) myDIV.appendChildnewDIV addPxnewDIV,myDIV,10\’缩进10象素 ChildID=0 ChildXPath=myDIV.getAttribute(\”XPath\”)&\”/\”&myChild.nodeName&\”[\”&ChildID&\”]\” dowhilenotdoc.selectSingleNode(ChildXPath)ismyChild 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) ifmyChild.childNodes.length>0then newDIV.attachEvent\”onclick\”,GetRef(\”attachOnclick\”) endif endif next myDIV.setAttribute\”parsed\”,true\’所有子元素都标记过了。 endsub subremoveDIV() dimoldDIV foreacholdDIVinoList.childNodes oldDIV.removeNode(true) next endsub subattachOnclick() dimobj,nodeXPath,cDIV setobj=window.event.srcElement nodeXPath=obj.getAttribute(\”XPath\”) ifinstr(nodeXPath,\”#text\”)>0then window.event.cancelBubble=true exitsub endif ifnotobj.getAttribute(\”parsed\”)=truethen appendDIVobj,doc.selectSingleNode(nodeXPath) else foreachcDIVinobj.children ifcDIV.style.display=\”none\”then cDIV.style.display=\”\” else cDIV.style.display=\”none\” endif next endif window.event.cancelBubble=true endsub functiongetText(myNode,oDIV) dimmyAttribute getText=\”\” selectcasefavour case\”text\” ifnotisnull(myNode.text)then getText=myNode.text else getText=\”空文字\” endif case\”nodeName\” getText=myNode.nodeName case\”attribute\” ifmyNode.nodeName<>\”#text\”then foreachmyAttributeinmyNode.attributes getText=getText&myAttribute.name getText=getText&\”=\”&chr(34) getText=getText&myAttribute.value&chr(34)&\”\” next getText=trim(getText) endif case\”XPath\” getText=oDIV.title endselect iftrim(getText)=\”\”thengetText=\”空\” endfunction subaddPx(newDIV,oldDIV,num) dimre,myString setre=newRegExp re.Global=true re.Pattern=\”[^\\d]*\” myString=re.Replace(oldDIV.style.paddingLeft,\”\”) ifmyString=\”\”thenmyString=\”0\” myString=(cint(myString)+num)&\”px\” newDIV.style.paddingLeft=myString setre=nothing endsub </script> </html>XMLTool.hta

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 hta hta实现的笨狼树状节点查看器 https://www.u-9.cn/jiaoben/hta/99722.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务