求助:ASP输出宽度的调整

gularma 2010-08-02 04:37:21
本人因为不懂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>
...全文
98 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
gularma 2010-08-06
  • 打赏
  • 举报
回复
正确格式是
strSql="select * from tel where tname like '%"&sqlchk(request("haoma"),0)&"%' and tel<>0 order by tname"

嘿嘿,试了好几次.
gularma 2010-08-03
  • 打赏
  • 举报
回复
诚心求助.
gularma 2010-08-03
  • 打赏
  • 举报
回复
嘎嘎,结帖.感谢各位好心人.
gularma 2010-08-03
  • 打赏
  • 举报
回复
感谢六楼教诲.我不是玩技术的人,我也不是接来赚钱的.
太小的改动了,花钱划不来.现在只是试用阶段,等有效果了我会花钱请人搞个全的,现在的界面就像小学生的作业.
l83203808 2010-08-03
  • 打赏
  • 举报
回复
strSql="select * from tel where tname like '%"&sqlchk(request("haoma"),0)&"%' and tel<>0"


strSql="select * from tel where tname like '%"&sqlchk(request("haoma"),0)&"%' and tel<>0 order by 姓名 desc"
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 gularma 的回复:]
各位大师,能写好源码我直接COPY吗?我真的啥也不懂,现学也来不及呀.拜托了.万分感谢.
[/Quote]
很奇怪,现学来不及的事情,为什么要接?解决这一个,其它的还很多的话,都这样? 效率,时间够吗?
有一两个疑问是可以的,但什么都不懂,除了去学,另外就是放弃.
gularma 2010-08-02
  • 打赏
  • 举报
回复
sql语句后添加order by 姓名

这个在哪添加??加了几次都位置不对.

SPAN那个搞定了.
gularma 2010-08-02
  • 打赏
  • 举报
回复
各位大师,能写好源码我直接COPY吗?我真的啥也不懂,现学也来不及呀.拜托了.万分感谢.
caizhuguanguan 2010-08-02
  • 打赏
  • 举报
回复
顶啊顶。。接分
灬上海爽爷 2010-08-02
  • 打赏
  • 举报
回复
1.可在<span>中添加STYLE <span style="width:100px"></span>这样。
2.按姓名排序 sql语句后添加order by 姓名

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧