求助:ASP输出宽度的调整
本人因为不懂ASP,现在向各位大师请教一下,帮忙修改一下源码.修改后可以直接复制用的.
要求达到效果:
1.输出的字段占用的宽度每一个都改成百分比或**PX这种格式,以方便我只要更改百分比的数值或多少PX就可以自由的控制每一个的宽度,以后加多字段输入,也可以合理控制.
2.因为可以模糊查询,希望输出结果按姓名字段自动排序后输出.
如果可以的话,你可以按你的思路优化页面.十分感谢!!
源码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="function.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询结果</title>
<style>
body {
text-align:center;
padding:0;
margin:0;
}
#main {
margin-left:auto;
margin-right:auto;
max-height:none;
min-height:100px;
padding:2px;
}
#main h2 {
text-align:center;
margin-top:12px;
}
.myol2 {
line-height:24px;
border:1px dotted #CCC;
padding:28px;
}
.myol2 li {
border-bottom:1px dotted #999;
list-style:none;
}
.myol2 a {
width:240px;
text-decoration:none;
display:inline-block;
}
.myol2 li span {
font-size:12px; /* 控制显示的字体大小;*/
width:8%; /* 控制每格显示的宽度百分比;*/
text-align:left;
padding:2px; /* 想起用表格形式就写background-color:#CCC;border:1px solid #333;*/
display:inline-block;
}
.myol2 em {
padding-left:24px;
font-size:14px;
color:#030;
}
.title span {
font-size:14px;
font-weight:900;
}
.clearfloat {
clear:both;
}
.STYLE1 {color: #1A50B8}
.STYLE2 {
color: #0000FF;
font-style: italic;
font-weight: bold;
font-size: 14px;
}
.STYLE6 {color: #FF0000}
.STYLE8 {
clear: both;
font-size: 12px;
}
.STYLE9 {
color: #3399FF
}
.STYLE11 {color: #3366FF}
.STYLE12 {font-size: 10px}
.STYLE13 {
color: #3399FF;
font-size: 12px;
}
.STYLE14 {
color: #FF0000;
font-size: 12;
}
.STYLE15 {font-size: 12px}
.STYLE18 {
font-size: medium;
color: #0099FF;
}
.STYLE19 {
font-size: medium;
font-weight: bold;
color: #FF0000;
}
</style>
</head>
<body>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20"><div align="center">
<p><img src="images/logo.gif" width="192" height="90"></p>
<p class="STYLE2">测试版</p>
<br>
</p>
</div></td>
</tr>
<tr>
<td>
<table width="459" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" background="images/top.gif"><span class="style1"> 成绩查询系统</span></td>
</tr>
<tr>
<td valign="middle" background="images/bg.gif"><p align="center"><br>
<span class="STYLE8">请输入姓名(支持模糊查询)</span></p>
<form name="form1" method="post" action="searchok.asp">
<div align="center">
<input name="haoma" type="text" class="input" id="chengyu3" size="25">
<input name="imageField2" type="image" src="images/search.gif" width="50" height="16" border="0">
</div>
</form>
<p align="center"> </p></td>
</tr>
<tr>
<td><img src="images/bottom.gif" width="459" height="7"></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<div id="main">
<%
if request("haoma")&""="" then
Response.Write("<script language=""JavaScript"">alert(""错误:请输入姓名!!"");history.go(-2);</script>")
response.end
end if
dim objRs,strSql
Set objRs=Server.CreateObject("ADODB.RecordSet")
strSql="select * from tel where tname like '%"&sqlchk(request("haoma"),0)&"%' and tel<>0"
objRs.Open strSql,strConn,1,3
if objRs.Eof then
response.write "<h2>数据库里没有成绩,请向老师查询</h2>"
else
%>
<h2>搜索结果</h2>
<ul class="myol2">
<li class="title">
<span>姓名</span>
<span>班级</span>
<span>电话</span>
<span>40GP</span>
<span>40HQ</span>
<span>加分</span>
<span>时间</span>
<span>教师</span>
<span>学期</span>
<span>备注</span></li>
<%
while not objRs.eof
%>
<li>
<span><%=objrs("tname")%></span>
<span><%=objrs("SHIP")%></span>
<span> <%=objrs("tel")%></span>
<span><%=objrs("40GP")%></span>
<span><%=objrs("40HQ")%></span>
<span><%=objrs("FJF")%></span>
<span><%=objrs("cls")%></span>
<span><%=objrs("TT")%></span>
<span><%=objrs("valid")%></span>
<span><%=objrs("note")%></span></li>
<%
objRs.Movenext
wend
end if
objRs.close
set objRs=Nothing
%>
</ul>
</div>
</body>
</html>