⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlcreatepage.asp

📁 XML+ASP 强大的自动生成静态产品目录网页实例,可完全代替数据库+服务端程序的网站设计模式.优点在于: 1.它只需在自己的配置有IIS或其它ASP执行软件的电脑上执行一次便自动生成大量(上传的示
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%

set objDom=CreateObject("MicroSoft.XMLDom")
'取得xml数据

'alert objDom.xml 
dir1="www.samluo.com/light"

htmlpart1="</TITLE> <LINK href=""/style.css"" type=text/css rel=stylesheet> <LINK href=""/style3.css"" type=text/css rel=stylesheet> <script src=""/xtree5.js""></script> </HEAD> <BODY>  <TABLE cellSpacing=0 cellPadding=0 width=800 align=center border=0> <TBODY> <TR> <TD width=330 background=/pic38.gif></TD> <TD align=middle width=110 background=/pic401.gif height=26><A href=""/index.asp"" target=_blank><B>SERVICE</B></A></TD><TD align=middle width=110 background=/pic401.gif height=26><A href=""light.htm"" target=_blank><B>CATALOGUE</B></A></TD> <TD align=middle width=110 background=/pic401.gif height=26><A href=""/cot.htm"" target=_blank><B>CONTACT</B></A></TD> <TD width=110 background=/pic38.gif></TD></TR></TBODY></TABLE>  <TABLE cellSpacing=0 cellPadding=0 width=800 height=""100%"" align=center border=0 valign=TOP> <TBODY>  <TR>  <TD vAlign=top align=left width=183 height=""100%"" background=/left_bg.jpg>  <TABLE cellSpacing=0 cellPadding=0 width=183 border=0 VALIGN=TOP> <TBODY> <TR><TD>  <TABLE style=""MARGIN-TOP: 0px"" cellSpacing=1 cellPadding=2 width=""100%"" bgColor=#c9e5ae border=0><TBODY> <TR bgColor=#f6ffec><TD>  <TABLE style=""BORDER-BOTTOM: #b6e784 2px solid"" cellSpacing=0 cellPadding=0 width=""100%"" bgColor=#cafb96 border=0> <TBODY> <TR> <TD><B><FONT color=#004b00> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lighting Services</FONT></B></TD></TR></TBODY></TABLE>  <TABLE cellSpacing=0 cellPadding=0 width=""100%"" align=center border=0> <TR> <TD align=top width=195> <TABLE cellSpacing=0 cellPadding=0 width=183 align=top border=0> <TR><TD></TD></TR> <TR> <TD>&nbsp;<IMG border=0 height=16 src=""/bb2.png"" width=16 align=absBottom>&nbsp;<strong><a href=""/serv2.htm"">Lighting project service</a></strong> </TD></TR><TR><TD>&nbsp;<IMG border=0 height=16 src=""/bb2.png"" width=16 align=absBottom>&nbsp;<strong><a href=""/serv3.htm"">Lighting export service</a></strong> </TD></TR></TABLE></TD></TR></TABLE></TD></TR></TBODY></TABLE>  <table style=""MARGIN-TOP: 3px"" cellspacing=1 cellpadding=2 width=""100%"" bgcolor=#c9e5ae border=0><tr bgcolor=#f6ffec><td>  <table style=""BORDER-BOTTOM: #b6e784 2px solid"" cellspacing=0 cellpadding=0 width=""100%"" bgcolor=#cafb96 border=0><tr><td><b><font color=#004b00> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lighting Articles</font></b></td></tr></table>  <table cellspacing=0 cellpadding=0 width=""100%"" align=center border=0><tr><td align=top width=195>  <table cellspacing=0 cellpadding=0 width=183 align=top border=0><tr><td></td></tr><tr><td>&nbsp;<img height=16 src=""/bb2.png"" width=16 align=absBottom border=0>&nbsp;<strong><a href=""/ul.htm"">North America Market( UL )</a></strong> </td></tr> <tr><td>&nbsp;<img height=16 src=""/bb2.png"" width=16 align=absBottom border=0>&nbsp;<strong><a href=""/ce.htm"">Europe Market ( CE ROHS )</a></strong> </td></tr></table> </td></tr></table> </td></tr></table> </TD></TR><TR><TD> <table style=""MARGIN-TOP: 3px"" cellspacing=1 cellpadding=2 width=""100%"" bgcolor=#c9e5ae border=0><tr bgcolor=#f6ffec><td>  <table style=""BORDER-BOTTOM: #b6e784 2px solid"" cellspacing=0 cellpadding=0 width=""100%"" bgcolor=#cafb96 border=0><tr><td><b><font color=#004b00> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lighting Catalogue</font></b></td></tr></table>  <table cellspacing=0 cellpadding=0 width=""100%"" align=center border=0><tr><td align=top width=195> <script language='javascript'>showtree(); </script> </td></tr></table> </td></tr></table>  </TD></TR><TR><TD> </TD></TR><TR><TD height=""100%"">  <TABLE cellSpacing=0 cellPadding=0 width=183 align=top border=0> <TBODY> <TR> <TD height=""100%""> </TD></TR></TBODY></TABLE> </TD></TR></TBODY></TABLE> </TD>  <TD class=col2-bg vAlign=top width=610> <TABLE cellSpacing=0 cellPadding=0 width=""100%"" border=0><TBODY><TR><TD><br>&nbsp;"
'positiontille
htmlpart2="</TD></TR><TR><TD vAlign=top height=350><TABLE cellSpacing=3 cellPadding=0 width=""100%"" align=center border=0><TBODY><TR><TD class=textLine vAlign=top> <TABLE cellSpacing=0 cellPadding=0 width=""100%"" border=0> <TBODY><TR> <TD width=521>&nbsp;</TD></TR> <TR><TD><br>"
'position
htmlpart30="</TD></TR> </TBODY></TABLE></TD></TR>  <TR><TD><P align=center>"
htmlpart31="</P><br><br></TD></TR><TR><TD class=textLine vAlign=top>Description of "
htmlpart4="</TD></TR> </TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY> </TABLE> </BODY></HTML>"



function savefile1(newfile,filecontent)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
dizhi=server.MapPath(newfile)
If (fs.FileExists(dizhi)) Then
fs.DeleteFile(dizhi)
End If
Set CrFi=fs.CreateTextFile(dizhi)
Crfi.Writeline(filecontent)
set CrFi=nothing
set fs=nothing
end function


function createxml1()
dim text1
dim p1
p1=0
dim p2
dim p3
dim p4
p2=0
p3=0
p4=0
dim len1
dim root1
len1=0

p2 = Instr(pictureset, "|")
If  p2<1 then
exit function
End if
'response.write "startok"
Do While p2 > 0

p1=p2

p2 = Instr(p1+1, pictureset, "|")
If  p2<1 then
exit function
End if
text1=Mid(pictureset,p1+1,p2-p1-1)
'generallighting\ceiling\general\gz115.jpg
'response.write text1
root1="//www.samluo.com"
text1= "\" & text1
len1= Len(text1)
p3= Instr(text1, "\")
Do While p3 < len1
p4= Instr(p3+1,text1, "\")
If  p4<1 then
p4= len1+1
End if
text2=Mid(text1,p3+1,p4-p3-1) 
'response.write text2
'response.write "root " & root1 & "/root "
Set objNode1 = objDom.documentElement.SelectSingleNode(root1)

If Not objNode1 Is Nothing Then
haschildnode1= 1

'If ( objNode1.hasChildNodes() = true ) then 
'Set objnodes=objNode1.ChildNodes
'for each element in objnodes
'If element.nodename = text2 then
'haschildnode1= 1
'end if
'next
'end if 
Set objNode1 = objDom.documentElement.SelectSingleNode(root1 & "/" & text2)
If objNode1 Is Nothing Then
haschildnode1= 0
'response.write "haschildnode=" & haschildnode1

'If (objNode1 is Nothing) then 
'- Do process 

'创建一个节点对象
Set Newnode=objDom.CreateElement(text2)
'给这个节点赴值
'Newnode.Text="人"
' 给这个节点添加属性
Set NewAttribute=objDom.CreateNode("attribute","id","") 
NewAttribute.Text= "id1"
Newnode.SetAttributeNode NewAttribute
Set NewAttribute=objDom.CreateNode("attribute","pt","") 
NewAttribute.Text= text1
Newnode.SetAttributeNode NewAttribute
Set NewAttribute=objDom.CreateNode("attribute","tl","") 
NewAttribute.Text= text2
Newnode.SetAttributeNode NewAttribute
Set NewAttribute=objDom.CreateNode("attribute","ds","") 
NewAttribute.Text= text2
Newnode.SetAttributeNode NewAttribute
objDom.documentElement.SelectSingleNode(root1).appendChild Newnode
'End If 
end if
root1=root1 & "/" & text2
'response.write root1
end if 

p3=p4
Loop


Loop



end function


function createpage1(inputroot)
dim text1
dim text2
dim text3
dim text4
dim file1
dim output3
output3=""
dim output11
dim number2
number2=1
dim p1
p1=0
dim p2
dim p3
dim p4
dim p5
dim p6
dim p7
p7=0
p6=0
p5=0
p2=0
p3=0
p4=0
dim len1
dim root1
len1=0
root1=inputroot
dim nodetyp1
nodetyp1=0
dim root2
Set objNode1 = objDom.documentElement.SelectSingleNode(root1)
If Not objNode1 Is Nothing Then
haschildnode1=objNode1.haschildnodes()
if haschildnode1 = true then

output1=" <table width=""100%"" align=""center"" border=""0"" cellspacing=""0"" cellpadding=""0"" > "
output11=" <table width=""100%"" align=""center"" border=""0"" cellspacing=""0"" cellpadding=""0"" > "
number1=0
parenttil1=objNode1.GetAttributeNode("tl").nodevalue
parentdes1=objNode1.GetAttributeNode("ds").nodevalue
parentdes1=replace(parentdes1,"*","<br>")
name1=objNode1.firstChild.nodename
'newstart = InStr([start, ]source, token[, compare])
nodetype1=InStr(name1,".")

if nodetype1 <2 then

set objnodes=objNode1.ChildNodes
text4=""
count1=objnodes.length
text2=root1
p7= Instr(3,text2,"/")
if p7 > 3 then
text4=text2
p6=Len(text4)
text4=Mid(text4,p7+1,p6-p7)
text4=replace(text4,"/","_")
file1=text4 & ".htm"
else 
file1="light.htm"
end if

'count1=1
'dirlist=""
'for each element in objnodes
'name1=element.nodename
'filename1=text4+"_"+name1+".htm"
'dirlist=dirlist+"<a href=""./"+filename1+""">"+
'next
dirlist=""

if count1 > 6 then
count2=count1
count3=1
filename1=file1
do while count2 > 0
dirlist=dirlist+"<a href=""./"+filename1+""">" & count3 & "</a>&nbsp;&nbsp; "
count3=count3+1
filename1=replace(filename1,".htm","1.htm")
count2=count2-6
loop
response.write dirlist
end if

output3="Present Category: &nbsp; >> "
p6= Instr(3,root1,"/")
Do While p6 > 3
text2=Mid(root1,1,p6-1) 
Set objNode3 = objDom.documentElement.SelectSingleNode(text2)
text3=objNode3.GetAttributeNode("tl").nodevalue
'response.write text3 & " / "
p7= Instr(3,text2,"/")
if p7 > 3 then
text4=text2
text4=replace(text4,"/","_")
text4=replace(text4,"_","/",1,3)
text4=replace(text4,"www.samluo.com",dir1)
'alert "http:" & text4 & ".htm"
output3=output3+"<a href=""http:" + text4 + ".htm""><b>" +Ucase(text3)+"</b></a> > "
else 
'alert text2 & "/light.htm" dir1="www.samluo.com/light"
output3=output3+"<a href=""http://" + dir1 + "/light.htm""><b>" +Ucase(text3)+"</b></a> > "
end if
'alert output3
p6= Instr(p6+1,root1,"/")
loop
output3=output3+"<b>" + Ucase(parenttil1) +"</b>"

count3=1

for each element in objnodes
'response.write element.nodename & "字节点名<br>"
'response.write element.text & "字节点值<br>"
name1=element.nodename
'nodeattr=element.GetAttributeNode("id").nodevalue
'id属性名
id1=element.GetAttributeNode("id").nodevalue
'id1属性值
'pt属性名
pic1=element.GetAttributeNode("pt").nodevalue
pic1="."+pic1
'\generallighting\ceiling\general\gz115.jpg属性值
'tl属性名
tit1=element.GetAttributeNode("tl").nodevalue
'generallighting属性值
'ds属性名
des1=element.GetAttributeNode("ds").nodevalue
des1=Mid(des1,1,140)
des1=replace(des1,"*","<br>")
des1=des1+" ..."
'generallighting属性值

'set objatr=element.attributes
'for each element1 in objatr
'response.write element1.nodename & "属性名<br>"
'response.write element1.nodevalue & "属性值<br>"
'next

if (number1 = 6) then
output1=output1+"</table>"

dirlist1=replace(dirlist,">" & count3 & "<", "><strong>[" & count3 & "]</strong><" )

filecontents="<HTML><HEAD><TITLE>"+parenttil1+htmlpart1+output3+htmlpart2+output1+htmlpart30+dirlist1+htmlpart31+"<strong>"+parenttil1+"</strong> :<p>"+parentdes1+htmlpart4
savefile1 file1,filecontents


file1=replace(file1,".htm","1.htm")
number1 = 0
count3=count3+1
number2=number2+1
output1=output11
end if


if (number1 mod 2 = 0) then
output1=output1+"<tr>"
end if
'output2="ssss' aaa  &nbsp; aaaa"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -