www.gusucode.com > 漂亮的地方旅游景点景观介绍网站源代码 > code.asp

    <!--#include file="config.asp" -->
<style type="text/css">
<!--
.inp {
	font-size: 12px;
	background-color: #F8FEE9;
	border: 1px solid #91AC22;
}
body,td,th {
	font-size: 12px;
}
body {
	background-color: #F8FEE9;
}
-->
</style>
<%
call openconn()

function getzdm(tab)
dim rs
set rs=conn.execute("select * from "&tab&"")
dim thing
for each thing in rs.fields
getzdm=getzdm&thing.name&","
next
if getzdm<>"" then 
getzdm=left(getzdm,len(getzdm)-1)
end if
rs.close
set rs=nothing
end function

function outhtml(str)
dim stemp
stemp = str
outhtml = ""
if isnull(stemp) = true then
exit function
end if
stemp = replace(stemp, "&", "&amp;")
stemp = replace(stemp, "<", "&lt;")
stemp = replace(stemp, ">", "&gt;")
stemp = replace(stemp, chr(34), "&quot;")
stemp = replace(stemp, chr(10), "<br>")
outhtml = stemp
end function

if Trim(Request.Form("tab"))<>"" then
dim zd
zd=getzdm(Trim(Request.Form("tab")))
%>

<table width="800" border="0" align="center" cellpadding="5" cellspacing="2" bgcolor="#B5DB42"style='table-layout:fixed'>
<tr>
<td bgcolor="#FAFEED"><strong>定义变量</strong></td>
</tr>
<tr>
<td bgcolor="#FAFEED"style='word-wrap : break-word'><%= "dim&nbsp;"&zd %></td>
</tr>
<tr>
<td bgcolor="#FAFEED"><strong>生成代码</strong></td>
</tr>
<tr>
<td bgcolor="#FAFEED"><%
dim zdstr,i
zdstr=split(zd,",")
for i=0 to ubound(zdstr)
Response.Write(outhtml(Trim(Request.Form("a"))))
if Trim(Request.Form("e"))=1 then 
Response.Write(zdstr(i))
end if
Response.Write(outhtml(Trim(Request.Form("b")))&"="&outhtml(Trim(Request.Form("c"))))
if outhtml(Trim(Request.Form("f")))=1 then 
Response.Write(zdstr(i))
End If
Response.Write(outhtml(Trim(Request.Form("d")))&"<br>")
next
%></td>
</tr>
</table>

<%
end if
%>
<form name="form1" method="post" action="">
<table width="800" border="0" align="center" cellpadding="5" cellspacing="2" bgcolor="#B5DB42">
<tr>
<td width="6%" bgcolor="#FAFEED">表名</td>
<td width="94%" bgcolor="#FAFEED"><input name="tab" type="text" class="inp" id="tab" value="<%= Trim(Request.Form("tab")) %>" size="30"></td>
</tr>
<tr>
<td bgcolor="#FAFEED">输出</td>
<td bgcolor="#FAFEED"><input name="a" type="text" class="inp" id="a" value="<%= Trim(Request.Form("a"))%>" size="20">
<select name="e" class="inp" id="e">
<option value="1" <% If Trim(Request.Form("e"))="1" Then Response.Write("selected") end if %>>字段</option>
<option value="2" <% If Trim(Request.Form("e"))="2" Then Response.Write("selected") end if %>>无</option>
</select>
<input name="b" type="text" class="inp" id="b" value="<%= Trim(Request.Form("b")) %>" size="20">
=
<input name="c" type="text" class="inp" id="c" value="<%= Trim(Request.Form("c")) %>" size="20">
<select name="f" class="inp" id="f">
<option value="1" <% If Trim(Request.Form("f"))="1" Then Response.Write("selected") end if %>>字段</option>
<option value="2" <% If Trim(Request.Form("f"))="2" Then Response.Write("selected") end if %>>无</option>
</select>
<input name="d" type="text" class="inp" id="d" value="<%= Trim(Request.Form("d")) %>" size="20"></td>
</tr>
<tr>
<td colspan="2" bgcolor="#FAFEED"><input name="Submit" type="submit" class="inp" value="提交"></td>
</tr>
</table>
</form>