<%'处理上述的问题,生成需要的格式
function outtable(byval content)
temp=0
htmlcode= "<table>"
content1=split(content,";")
for i=0 to ubound(content1)
templen=instr(content1(i),"=")
if templen>0 then
htmlcode=htmlcode & "</tr><tr><td colspan=3>"&left(content1(i),templen-1)&"</td></tr><tr>"
content1(i)=mid(content1(i),templen+1)
temp=i
else
if (i-temp) mod 3 =0 then htmlcode=htmlcode & "</tr><tr>"
end if
htmlcode=htmlcode & "<td>" & content1(i) & "</td>"
next
if (i-temp-1) mod 3 <> 0 then
for j=1 to i-1
htmlcode=htmlcode & "<td></td>"
next
end if
htmlcode=htmlcode & "</tr>"
htmlcode=htmlcode & "</table>"
'return htmlcode
content=htmlcode
end function
%>
<%
set rs=server.createobject("adodb.recordset")
Set fso = CreateObject("Scripting.FileSystemObject")
sqla="select * from product where id=466 "
rs.open sqla,conn,1,1
set test=server.createobject("adodb.recordset")'打开数据库中的模板文件,用于生成HTML
modesql="select * from mode where id=1"
test.open modesql,conn,1,1
modehtml=test("modehtml")
test.close
<%
function htmlcode(byval content)
temp=0
htmlcode= "<table>"
content1=split(content,";")
for i=0 to ubound(content1)
templen=instr(content1(i),"=")
if templen>0 then
htmlcode=htmlcode & "</tr><tr><td colspan=3>"&left(content1(i),templen-1)&"</td></tr><tr>"
content1(i)=mid(content1(i),templen+1)
temp=i
else
if (i-temp) mod 3 =0 then htmlcode=htmlcode & "</tr><tr>"
end if
htmlcode=htmlcode & "<td>" & content1(i) & "</td>"
next
if (i-temp-1) mod 3 <> 0 then
for j=1 to i-1
htmlcode=htmlcode & "<td></td>"
next
end if
htmlcode=htmlcode & "</tr>"
htmlcode=htmlcode & "</table>"
outtable=htmlcode
end function
%>
<%
set rs=server.createobject("adodb.recordset")
Set fso = CreateObject("Scripting.FileSystemObject")
sqla="select * from product where id=466 "
rs.open sqla,conn,1,1
set test=server.createobject("adodb.recordset")'打开数据库中的模板文件,用于生成HTML
modesql="select * from mode where id=1"
test.open modesql,conn,1,1
modehtml=test("modehtml")
test.close
<%
function outtable(byval content) '用于处理输出的格式,就是上面所提的问题
content1 = Split(content,"=")
For j=0 to Ubound(content1)-1
a=split(content1(j),";")(UBound(split(content1(j),";")))
response.write("<TR><TD colspan=3>")
response.write(a)
response.write("</TD></TR>")
response.write("<tr>")
'on error resume next
content2 = Split(content1(j+1),";")
For i=0 to UBound(content2)-1
If i Mod 3=0 Then Response.write("<tr>")
response.write("<TD width=100>")
response.write(content2(i))
response.write("</TD>")
Next
response.write("</TR>")
Next
end function
%>
<%
set rs=server.createobject("adodb.recordset")
Set fso = CreateObject("Scripting.FileSystemObject")
sqla="select * from product where id=466 "
rs.open sqla,conn,1,1
set test=server.createobject("adodb.recordset")'打开数据库中的模板文件,用于生成HTML
modesql="select * from mode where id=1"
test.open modesql,conn,1,1
modehtml=test("modehtml")
test.close
<%
function outtable(byval content)
temp=0
htmlcode= "<table>"
content1=split(content,";")
for i=0 to ubound(content1)
templen=instr(content1(i),"=")
if templen>0 then
htmlcode=htmlcode & "</tr><tr><td colspan=3>"&left(content1(i),templen-1)&"</td></tr><tr>"
content1(i)=mid(content1(i),templen+1)
temp=i
else
if (i-temp) mod 3 =0 then htmlcode=htmlcode & "</tr><tr>"
end if
htmlcode=htmlcode & "<td>" & content1(i) & "</td>"
next
if (i-temp-1) mod 3 <> 0 then
for j=1 to i-1
htmlcode=htmlcode & "<td></td>"
next
end if
htmlcode=htmlcode & "</tr>"
htmlcode=htmlcode & "</table>"
response.write "<textarea cols=40 rows=6>"&htmlcode&"</textarea>"
response.write htmlcode
end function
%>
content1 = Split(content,"=")
For j=0 to Ubound(content1)-1
a=split(content1(j),";")(UBound(split(content1(j),";")))
response.write("<TR>")
response.write("<TD colspan=3>")
response.write(a)
response.write("</TD></TR>")
response.write("<tr>")
'on error resume next
content2 = Split(content1(j+1),";")
For i=0 to UBound(content2)-1
If i Mod 3=0 Then Response.write("<tr>")
response.write("<TD width=100>")
response.write(content2(i))
response.write("</TD>")
Next
response.write("</TR>")
Next
end function
%>