12
返回列表 发新帖
楼主: zxlshashala

[原创] asp问题请教

[复制链接]
论坛徽章:
117
ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322015年新春福章
日期:2015-03-04 14:19:11马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14比亚迪
日期:2013-09-18 09:31:09迷宫蛋
日期:2013-06-05 13:48:452013年新春福章
日期:2013-02-25 14:51:24
11#
发表于 2004-12-5 12:41 | 只看该作者
没传对而已!

你可以这样检查,先在页面转向时alert出来,看url有无参数值,再在asp
文件中看是否接受得到。这种方法一定可行的。

还有一种方法使用hidden的input,根据不同条件在页面中更改form.action然后
在提交,通过reqest.form也可以成功传递参数的。

使用道具 举报

回复
论坛徽章:
0
12#
发表于 2004-12-6 00:27 | 只看该作者
么,我复制你的代码怎么就没出现你说的情况

使用道具 举报

回复
论坛徽章:
0
13#
 楼主| 发表于 2004-12-6 15:35 | 只看该作者
是不是我的意思没有描述清楚。把这两个页的主要代码粘来吧。
wzml_manager.asp页程序如下<html>
<head>
<title>物资目录管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!-- A:link     {font-style: normal; text-decoration: none; cursor: hand; color: #000000}
a.lhot2:link { color: #336699; text-decoration: none; font-size: 9pt }   
.font2       { color: #800000; font-size: 11pt; font-weight: bold }
a.lhot2:active { color: #336699; text-decoration: none; font-size: 9pt }   
a.lhot2:visited { color: #006699; text-decoration: none; font-size: 9pt }   
a.lhot2:hover { color: #FF6600; font-size: 9pt; font-weight: none; text-decoration: underline }
A:visited  {font-style: normal; text-decoration: none; color: #000000}
A:active   {font-style: normal; text-decoration: none; color: #000000}
A:hover    {text-decoration:underline;color:#FF6600;}
.unnamed1 {  font-family: "宋体"; font-size: 12px; font-style: normal; text-decoration: none; line-height: 18px}
.title1 {  font-size: 30px; line-height: 80px; font-weight: bolder; color: #6699FF; text-decoration: none; font-family: "楷体_GB2312"}
.projectname {  font-family: "黑体"; font-size: 16px; font-weight: bold; line-height: normal; color: #000000; text-decoration: none}
.vicetitle {  font-family: "黑体"; font-size: 16px; color: #000000; text-decoration: none; font-weight: bold}
.button {  height: 21px; margin-top: 8px; margin-bottom: 8px; background-color: #99CCFF; border-style: groove}
.demo {  background-color: #CCCCCC; color: #000099; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
.year {  height: 18px; width: 40px; vertical-align: text-bottom}
.month {  vertical-align: text-bottom; height: 18px; width: 20px}
.title12 {  font-family: "宋体"; font-size: 16px; font-style: normal; color: #CC0000}
table {  font-size: 9pt}
-->

</style>
</head>
<body bgcolor="#336699" background="image/tecbkgnd.gif" text="#000000">
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center" height="49">
  <tr>
    <td height="12"><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="125">
        <param name="movie" value="flash/top.swf">
        <param name="quality" value="high">
        <embed src="flash/top.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="760" height="125"></embed></object></td>
   </tr>
</table>                    
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="620" bgcolor="#CCCC33" height="22" align="left">&nbsp; 您现在的位置: 首页
      <marquee scrollamount=1 behavior=alternate width=20 style="position:relative;top:0px;" height="12">=>></marquee>
      <font color="#0033CC">物资目录管理</font></td>
    <td width="30" height="22" bgcolor="#669999"><img src="image/right.gif" width="31" height="22"></td>
  </tr>
  <tr valign="top">
    <td colspan="2" height="355">
      <table width="760" border="0" cellspacing="0" cellpadding="0" height="245">
        <tr>
          <td height="385" valign="top" bgcolor="#FFFFFF">
                  <table border="0" width="758" cellspacing="0" cellpadding="0">
              <tr>
                <td width="100%" align="center"><strong><br>
                  物资目录管理</strong></td>
              </tr>
              <tr valign="top">
                <td align="center" valign="top"><form name="form1" method="post" action="wzml_manager1.asp">
                    物资编号
                    <input name="wzbh" type="text" id="wzbh">
                    &nbsp;&nbsp;&nbsp; 物资名称
                    <input name="wzmc" type="text" id="wzmc" alt="可单独查询也可联合查询">
                    &nbsp;
                    <input type="submit" name="Submit2" value="查询">
                  </form>
                  <a href="new_wzml.asp"> [添加新物资]</a>
                  <%  
   set rs=server.createobject("adodb.recordset"
      mysql="select * from material_info1"
rs.open mysql,conn,3,3
if rs.eof then      
    response.write("暂无数据"
        response.End
         end if
                        page = CLng(Request("txtpage")
                        RS.PageSize = 20
                        page = CLng(Request("txtpage")
                        If page < 1 Then page = 1
                        If page > RS.PageCount Then page = RS.PageCount
                        RS.AbsolutePage = page
                        i= rs.pagesize*(page-1)+1   
                                       

%>
                  <table width="747" border="0" cellpadding="2" cellspacing="1" bgcolor="#993366">
                    <tr bgcolor="#3399CC">
                      <td width="4%" height="12" align="center"><font color="#FFFF00">序号
                        </font></td>
                      <td width="16%" align="center"><font color="#FFFF00">物资编号(添加招标计划)</font></td>
                      <td width="18%" align="center"><font color="#FFFF00">物资名称</font></td>
                      <td width="29%" align="center"><font color="#FFFF00">规格型号</font></td>
                      <td width="4%" align="center"><font color="#FFFF00">单位</font></td>
                      <td width="7%" align="center"><font color="#FFFF00">修改目录</font></td>
                      <td width="7%" align="center"><font color="#FFFF00">删除目录
                        </font></td>
                      <td width="8%" align="center"><font color="#FFFF00">最后一次修改时间</font></td>
                      <td width="7%" align="center"><font color="#FFFF00">最后一次修改人</font></td>
                    </tr>
                    <br>
                    <%                     
        For ipage = 1 To RS.PageSize
                                                       
      %>
                    <script language=javascript>
<!--
function sbar (st,col) { st.style.backgroundColor = '#e7e7e7'; }
function cbar (st) { st.style.backgroundColor = ''; }
// -->   
</script>
<script language="JavaScript">
function del(){
if (confirm('确定删除该记录吗?'))
{
window.location.href="delete_wzml.asp?bh="+<%response.Write(rs("wzbh")%>;
//else
//response.Redirect(wzml_manager.asp);
}
}
</script>
                    <tr bgcolor="#FFFFFF" onMouseOver="sbar(this)" onMouseOut="cbar(this)">
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid">&nbsp;<%=i%> </td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid"><a href="new_zbjh.asp?bh=<%=rs("wzbh"%>"><%=rs("wzbh"%></a></td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid">&nbsp;<%=rs("wzmc"%></td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid">&nbsp;<%=rs("ggxh"%></td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid">&nbsp;<%=rs("dw"%></td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid"><img src="image/edit.gif" width="16" height="16"><a href="edit_wzml.asp?bh=<%=rs("wzbh")%>">修改</a>
                      </td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid"><img src="image/del.gif" width="16" height="16"><a onClick="del();return false;" href="delete_wzml.asp?bh=<%=rs("wzbh")%>">删除</a>

                      </td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid"><%=rs("edit_time")%>&nbsp;</td>
                      <td height="16" align="center" style="BORDER-BOTTOM: #e7e7e7 1px solid"><%=rs("edit_user")%>&nbsp;</td>
                    </tr>
                    <%               
rs.movenext
i=i+1
if rs.eof then exit for
next            
%>
                  </table>
                  <form action="wzml_manager.asp" method="get">
       <font size="2"> <%
                        If page = 1 Then
                           Response.Write "&nbsp;第一页&nbsp;"
                           Response.Write "&nbsp;上一页&nbsp;"
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=" & (page + 1) & ">下一页</a>&nbsp;"
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=" & RS.PageCount & ">最后一页</a>&nbsp;"
                        else
                        If page = RS.PageCount Then
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=1>第一页</a>&nbsp;"
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=" & (page - 1) & ">上一页</a>&nbsp;"
                           Response.Write "&nbsp;下一页&nbsp;"
                           Response.Write "&nbsp;最后一页&nbsp;"
                        else
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=1>第一页</a>&nbsp;"
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=" & (page - 1) & ">上一页</a>&nbsp;"
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=" & (page + 1) & ">下一页</a>&nbsp;"
                           Response.Write "&nbsp;<a href=wzml_manager.asp?txtpage=" & RS.PageCount & ">最后一页</a>&nbsp;"
                        End If
                        end if
                        session("i")=i
%></font>
                  <span ><font size="2">记录数:</font></span><font size="2"><%=RS.RecordCount%></font> &nbsp;&nbsp;<span ><font size="2">当前页数/总页数:</font></span><span class="..\css\word">
                  </span><font color=ff0000 size="2"><%=page%></font> / <font color=0000ff size="2"><%=RS.PageCount%></font> &nbsp;&nbsp; <span class="yglz"><font size="2">转到</font></span>
                  <font size="2">
                  <input type="text" name="txtpage" value="<%=page%>" size="2" class=pc style="HEIGHT:16px; WIDTH: 25px;font-size: 9pt">
                  <span class="yglz">页</span></font>
                  <input type="submit" value="跳 转"  style="height:18;WIDTH:45px;color:ffffff;background:94aad6;" id=submit1 name=submit1>
                    <div align="center"></div>
      </form>          <%
           rs.close
set conn=nothing
%>
              </tr>
              <tr>
                <td height="12">&nbsp;</td>
              </tr>
   
            </table>
                   </td>
        </tr>
      </table>
       
    </td>
  </tr>
</table>
                                                                                                                                                                                                                    
  <table width="760" border="0" cellspacing="0" cellpadding="0" height="62" align="center">
    <tr>
      <td width="760" height="62" align="center" valign="top" bgcolor="#336699">
        <input name="imageField" type="image" src="image/line.gif" align="top" width="750" height="10" border="0">
      <div align="center"> </div>
      <p align="center"><font color="#CCCCCC">Copyright&#169版权所有:<font color="#FF9900">中国北车集团
        </font></font> <font color="#CCCCCC"><font color="#66FFFF"> 建议采用800*600分辨率</font></font></p>
      <p align="center"><font color="#FF9900"> </font> </p>
        
      </td>
    </tr>
  </table>

</div>
</body>
</html>
                    
delete_wzml.asp程序如下:
<%
set rs=server.createobject("adodb.recordset")
sql="delete from material_info1 where wzbh='"&request("bh")&"'"
rs.open sql,conn,1,1
response.Redirect"wzml_manager.asp"
rs.close
set conn=nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
</body>
</html>

使用道具 举报

回复
论坛徽章:
117
ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322015年新春福章
日期:2015-03-04 14:19:11马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14比亚迪
日期:2013-09-18 09:31:09迷宫蛋
日期:2013-06-05 13:48:452013年新春福章
日期:2013-02-25 14:51:24
14#
发表于 2004-12-6 15:55 | 只看该作者
function del(){
if (confirm('确定删除该记录吗?'))
{
window.location.href="delete_wzml.asp?bh="+<%response.Write(rs("wzbh")%>;
//else
//response.Redirect(wzml_manager.asp);
}
}
这个地方一看就错了!你在上一代码wzml_manager.asp运行后看
生成的源代码就知道为什么错了!!!

这样写:

function del(a){
if (confirm('确定删除该记录吗?'))
{
window.location.href="delete_wzml.asp?bh="+a;
}
另外一处:
<a onClick='del(<%=rs("wzbh"%>'>删除</a>
大概意思,语法不太对的!

使用道具 举报

回复
论坛徽章:
0
15#
 楼主| 发表于 2004-12-7 11:34 | 只看该作者
按照你的方法,还是通不过,这种情况下,无论点确定还是取消都不能删除该条记录。我用alert试了一下,参数值总是为0,所以在wzml_manager.asp页中,参数就没有传对,更别说delete_wzml.asp中接收参数了。好费劲的,javascript我不熟悉,所以总觉先从asp里传到javascript,再从javascript里又传到asp。

使用道具 举报

回复
论坛徽章:
0
16#
 楼主| 发表于 2004-12-7 11:36 | 只看该作者
谢谢你对我的问题一直关注。

使用道具 举报

回复
论坛徽章:
117
ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:322015年新春福章
日期:2015-03-04 14:19:11马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14比亚迪
日期:2013-09-18 09:31:09迷宫蛋
日期:2013-06-05 13:48:452013年新春福章
日期:2013-02-25 14:51:24
17#
发表于 2004-12-7 12:55 | 只看该作者
可以很自信的告诉你,我这个方法没有错的!你在del中添加这样一句:
function del(a){
alert(a);
if (confirm('确定删除该记录吗?'))
{
window.location.href="delete_wzml.asp?bh="+a;
}
}
就知道参数传过去了没有!记住,我说的是需要修改两个地方的。
写asp不用javascript搞不好的。

使用道具 举报

回复
论坛徽章:
0
18#
 楼主| 发表于 2004-12-7 17:26 | 只看该作者
是呀,我的确是改了两个地方,一个是调用del()的地方,一个是定义del()的地方。就是按照你上边写的那样,用alert测试参数值为0。我觉得应该改delete_wzml.asp页中接收参数的地方。总觉得用requesr("bh"好像接收不到参数。
   我再试试,觉得自己好笨哦!!!

使用道具 举报

回复
论坛徽章:
0
19#
 楼主| 发表于 2004-12-7 18:02 | 只看该作者
好了,搞定了,是因为我的参数是字符类型的,而wzbh中有000002这样的数据,所以传过来就成2,所以总是不对,十分感谢cowherd,感谢你对我的帮助

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表