求助选择下拉列表的值后文本框自动填入相应的内容

wsmhzyaba 2022-04-21 12:46:40
<select size="1" name="rs_cpu1" style="font-size: 16px; width: 80%; height: 30px;" 
onChange="cpu_price.value=<% =rs_cpu("price")%>,XJ1.value=<% =rs_cpu("price")%>*1" >

                    <% do While Not rs_cpu.EOF  %>
                    <option value='<% =rs_cpu("name")%>'><% =rs_cpu("name")%></option>              
	  <%
    				  rs_cpu.MoveNext
					  loop
					  rs_cpu.close
				%></select>

<input name="cpu_price" type="text" class="doc_txt" style="width: 50; height: 22"  size="20">

 

这个文本框里只能显示第一个产品的价格 再点就没有反应了,用不刷新页面怎么做?  刷新页面怎么做?

求指导

...全文
167 回复 打赏 收藏 举报
写回复
回复
切换为时间正序
请发表友善的回复…
发表回复
相关推荐
一个典型的档案管理系统源码 <% action = request("action") %> <% if session("adminname") = "" or session("adminpassword") = "" then %> <% else %> <% set rswebsite=server.createobject("adodb.recordset") sqlwebsite = "select *,web_id from website " rswebsite.open sqlwebsite,conn,1,1 %> 信息查询
">" alt="logo" name="logo" width="200" height="60" border="0" id="logo" />  
首页 添加数据 添加班级 信息查询 快速浏览 收录设置 添加管理员 系统设置 数据备份 数据恢复 修改密码 留言管理 退出系统
<%=rswebsite("web_note")%>
信 息 查 询
   
<% keyword=replace(replace(replace(replace(replace(trim(request("keyword")),"'",""),"<","("),">",")"),">",")"),"<","(") typeid=replace(replace(replace(replace(replace(trim(request("typeid")),"'",""),"<","("),">",")"),">",")"),"<","(") %>
<% if action="ok" then %> <%set rsstudent=server.createobject("adodb.recordset") if keyword="" then response.redirect "admin_xxcx.asp" end if if typeid="" then sqlstudent="select * from student where name like '%"&keyword&"%' order by adid desc" end if if typeid="1" then sqlstudent="select * from student where name like '%"&keyword&"%' order by adid desc" end if if typeid="2" then sqlstudent="select * from student where class like '%"&keyword&"%' order by adid desc" end if if typeid="3" then sqlstudent="select * from student where spcialty like '%"&keyword&"%' order by adid desc" end if if typeid="4" then sqlstudent="select * from student where Source_school like '%"&keyword&"%' order by adid desc" end if if typeid="5" then sqlstudent="select * from student where sex like '%"&keyword&"%' order by adid desc" end if if typeid="6" then sqlstudent="select * from student where Native_place like '%"&keyword&"%' order by adid desc" end if if typeid="7" then sqlstudent="select * from student where nation like '%"&keyword&"%' order by adid desc" end if if typeid="8" then sqlstudent="select * from student where father_name like '%"&keyword&"%' order by adid desc" end if if typeid="9" then sqlstudent="select * from student where mother_name like '%"&keyword&"%' order by adid desc" end if if typeid="10" then sqlstudent="select * from student where Population_property like '%"&keyword&"%' order by adid desc" end if if typeid="11" then sqlstudent="select * from student where name2 like '%"&keyword&"%' order by adid desc" end if if typeid="12" then sqlstudent="select * from student where status_number like '%"&keyword&"%' order by adid desc" end if if typeid="13" then sqlstudent="select * from student where Political_feature like '%"&keyword&"%' order by adid desc" end if if typeid="14" then sqlstudent="select * from student where adnumber like '%"&keyword&"%' order by adid desc" end if if typeid="15" then sqlstudent="select * from student where status_number like '%"&keyword&"%' order by adid desc" end if if typeid="16" then sqlstudent="select * from student where tele like '%"&keyword&"%' order by adid desc" end if if typeid="17" then sqlstudent="select * from student where Population_property like '%"&keyword&"%' order by adid desc" end if if typeid="18" then sqlstudent="select * from student where nowaddress like '%"&keyword&"%' order by adid desc" end if if typeid="19" then sqlstudent="select * from student where Address like '%"&keyword&"%' order by adid desc" end if if typeid="20" then sqlstudent="select * from student where mother_work like '%"&keyword&"%' order by adid desc" end if if typeid="21" then sqlstudent="select * from student where father_work like '%"&keyword&"%' order by adid desc" end if if typeid="22" then sqlstudent="select * from student where admin like '%"&keyword&"%' order by adid desc" end if if typeid="23" then sqlstudent="select * from student where change like '%"&keyword&"%' order by adid desc" end if rsstudent.open sqlstudent,conn,1,1%> <%if rsstudent.eof and rsstudent.bof then%> <%response.write ""%> <%else%> <%do while not rsstudent.eof or rsstudent.bof %> <% rsstudent.movenext %> <%loop%> <% rsstudent.close set rsstudent = nothing %> <%end if%> <%end if%>
姓名 班级 性别 联系电话 籍贯 民族 特长 来源学校 操 作
<%=rsstudent("name")%> <%=rsstudent("class")%> <%=rsstudent("sex")%> <%=rsstudent("tele")%> <%=rsstudent("Native_place")%> <%=rsstudent("nation")%> <%=rsstudent("spcialty")%> <%=rsstudent("Source_school")%> ">详 细

Copyright© 2009-2010 longxiang All Rights Reserved.
<% end if %>
PHP实例之新闻发布系统 Create TABLE `news` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `p_time` DATETIME NOT NULL , `title` VARCHAR( 80 ) NOT NULL , `detail` TEXT NOT NULL ) TYPE = innodb; create table news(id int not null auto_increment primary key, p_time datetime not null, title varchar(80)not null, detail text not null )type=innodb; 数据库连接:conn.php <? $conn = @mysql_connect('localhost','root','')or die(mysql_error()."不能连接到数据库!"); //连接数据库; $db = mysql_select_db('news',$conn); $page_size = 8; //每页最多显示新闻条数; ?> 添加新闻页面:new.php <? $title="新闻发布系统"; include("inc/header.inc");//头文件 ?> <style type="text/css"> <!-- .STYLE1 {font-size: 12px} .title { font-size: 12px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; font-family: "宋体"; color: #993300; line-height: normal; height: 16px; } .field { font-family: "宋体"; font-size: 12px; color: #993333; } .STYLE2 { font-size: 16px; font-weight: bold; } --> </style>

PHP+Mysql新闻发布

<form action="post.php" method="post" name="frm" id="frm">
标题:
<input name="title" type="text" class="title" id="title" size="60" maxlength="80"></td>
内容
<textarea name="textfield" cols="58" rows="6" class="field"></textarea>
<input name="submit" type="submit" value="发布"></td>
</form> <? include("inc/navbar.inc");//底部 ?> 新闻处理页面:post.php <? include"conn.php"; $title=htmlspecialchars($_POST['title']); $textfield=htmlspecialchars($_POST['textfield']); $pub_time=date('Y')."-".date('m')."-".date('d')." ".date('H').":".date('i').":".date('s'); $query="insert into news(title,detail,p_time)values ('$title','$textfield','$pub_time')"; $result=mysql_query($query); if($result) { echo "发布成功!
"; echo "
新闻列表 继续发布"; } else { echo mysql_error()."
"; echo "发布失败!请返回"; } ?> 新闻列表:list.php <? include "conn.php"; $query = "Select COUNT(*) FROM news"; $result = mysql_query($query); $num = mysql_num_rows($result); $page_count = ceil($num/$page_size); //$offset = ($page_count-1)*$page_size; if(empty($_GET['page'])) { $page = 1; }else { $page = $_GET['page']; if($page<=0) { $page = 1; }else { $page >= $page_count; $page = $page_count-1; } } $query ="Select * FROM `news` orDER BY `id` DESC LIMIT ".($page-1)*$page_count.","."$page_size"; $result = mysql_query($query); ?> <?php while($l_result = mysql_fetch_array($result)) { ?> <?php } ?>
标题
时间
<?php echo $l_result['id'];?>

发布信息
<?php //页码显示 for ($i=1;$i<=($page_count-1);$i++){ echo "".$i." "; } //页码显示 ?> 新闻显示页面:view.php <? include "conn.php"; $query = "Select * FROM news where id=".$_GET['id']; $result = mysql_query($query); $v_result = @mysql_fetch_array($result); ?> <table width="60%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#0066FF"> 标题: <?php echo $v_result['title'];?> 内容: <?php echo $v_result['detail'];?> 返回
<% BookIDList = Session("BookIDList")'session(BookIDList)第一次运行为空 ABookID = Split(Request("bookID"), ", ")'ABookID数组存入的是图书的id' For I=0 To UBound(ABookID)'显示数组的最大维数 If Len(BookIDList) = 0 Then BookIDList = "'" & request("bookID") & "'" ElseIf InStr( BookIDList, request("bookID")) 您的购物车为空! 您还没有选购任何书籍,您的购物车为空! <% if request.Form("jiezhang")="保存订单" then response.Redirect("checkout.asp") end if If Len(Session("BookIDList")) 0 Then sql = "Select * From tb_book Where isbn In (" &_ session("bookIDList") & ") Order By isbn" Set rs = cnn.Execute( sql ) else Response.Redirect "buycarempty.asp" end if %> 查看购物车 function stand(){ window.close();} 书号 书 名 单价 数量 金额 移去     <% sl = Request( "sl"&i) If sl (元) (元) 合计金额: (元) 清空购物车 <% session("mName")="" if request.Form("UserID")"" and request.Form("userPWD")"" then session("ID1")=request.Form("UserID") session("PWD")=request.Form("userPWD") set rs=Server.CreateObject("ADODB.RecordSet") sql="SELECT userid, password FROM tb_member WHERE userid='" & session("ID1")&"'" set rs=cnn.execute(sql) if rs.eof then %> alert("登录失败!"); window.history.back(); window.location.href="checkoutok.asp" alert("您输入的会员密码错误,请重新输入!"); history.back(); 保存订单信息 //检验会员ID号和密码 function check(){ if (form1.userID.value==""){ alert("请输入会员ID号!");form1.userID.focus();return;} if (form1.userPWD.value==""){ alert("请输入会员密码!");form1.userPWD.focus();return;} form1.submit();} 如果您还不是我们的会员,请单击“注册”按钮注册会员! 会员ID号: 注册 您的密码:   以是您选购的图书: 书号 书名 单价 数量 金额   (元) (元) 订单保存成功!   <% '返回订单号等信息 orderid=objCmd.Parameters(3) sql1 = "Select * From tb_book Where isbn In (" & session("checkBook") & ")" Set rs = cnn.Execute( sql1 ) ASL1="" ASL1=split(session("sl"),",") i=0 sum=0 shuliang=0 while not rs.eof bookID=rs("isbn") price=rs("price") paSL=cInt(ASL(i)) booksum=cdbl(rs("price"))*ASL(i) sql2="insert into tb_orderdetail(orderid,isbn,num,money) values ('"&_ orderid&"','"&bookID&"',"&paSL&","&booksum&")" set rs1=cnn.execute(sql2) i=i+1 rs.movenext wend for each parm in objCmd.Parameters if parm.name="parID" then name1="会员ID" end if if parm.name="sum" then name1="订货金额" end if if parm.name="oDate" then name1="订购日期" end if if parm.name="aa" then name1="订单号" end if Response.Write name1 &":"& trim(parm) if name1="订货金额" then response.write "元" else response.write "" end if next %> 订单已经成功保存,欢迎次惠顾! 网上图书订购 AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','639','height','119','src','../images/banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/banner' ); //end AC code 网站首页 查看购物车 会员登录 管理员登录 书号 书名 出版社 图书类型 作者 等于 Like 查询图书库存量 书号 书名 图书类型 等于 Like <% If (Request("cValue") "" and Request("sField") "") Then If (Request("cValue") "") Then session("INvalue") = Request("cValue") End If session("pBookName") = "BookName" If (Request("sField") "") Then session("pBookName") = Request("sField") End If session("pBookName")=Replace(session("pBookName"), "'", "''") session("INvalue")=Replace(session("INvalue"), "'", "''") If (Request("mode") "") Then session("rs_mode") = Request("mode") End If end if if session("rs_mode")"" then if session("rs_mode")="==" then sql= "SELECT isbn, bookname, kind, price,total FROM tb_total WHERE "_ + session("pBookName") + " = '" + session("INvalue") + "'" else sql = "SELECT isbn, bookname, kind, price,total FROM tb_total WHERE "&_ session("pBookName") & " Like '%" & session("INvalue") & "%'" end if else sql="SELECT isbn, bookname, kind, price,total FROM tb_total " end if set rs_search=Server.CreateObject("ADODB.RecordSet") rs_search.open sql,cnn,1,3 %> function newwin1(url){ var newwin=window.open(url,"","resizable=yes,scrollbars=yes,width=700,height=400"); newwin.focus(); return false; } 书号 书 名 图书类型 价格 库存 alert("无符合条件的图书!") history.back(1) <%response.end() end if '分页' rs_search.pagesize=7 page=CLng(Request("page")) if page <% if page1 then %> 第一页  上一页 <%end if if pagers_search.pagecount then %>  一页  一页 无符合条件的记录! <% response.Expires=-1 username1=trim(request("username")) userpass1=trim(request("userpass")) if username1="" or userpass1="" then session("passed1")="" session("msg1")="用户ID和密码不能为空" else set rs=server.CreateObject("adodb.recordset") strsql="select * from tb_member where userid='"&username1&"'" rs.open strsql,cnn,3,3 if rs.eof then session("passed1")="" session("msg1")="用户ID不存在" else if rs("PassWord")userpass1 then session("passed1")="" session("msg1")="密码错误" else session("passed1")=true session("msg1")="" session("ID1")=username1 session("username1")=rs("UserName") end if end if end if response.Redirect("memberlogin.asp") %> 会员登录 function chkfields(){ if(document.myform.username.value==''){ alert("用户ID不能为空"); document.myform.username.focus(); return false; } if(document.myform.userpass.value==''){ alert("用户密码不能为空"); document.myform.userpass.focus(); return false; } return true; } function look(id){ window.open("orderhistory.asp?ID="+id,"","scrollbars=yes,resizable=yes,width=700,height=600"); } AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','639','height','119','src','../images/banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/banner' ); //end AC code 网站首页 查看购物车 会员登录 管理员登录 <% if session("msg1")"" then response.write session("msg1") else response.write "用户登录" end if %> I  D: 密 码:    用户 , 您已成功登录 会员注册成功 祝贺您,已经注册成功! 您的会员ID号为:[ ] 密码为: [ ] 请记好! 单击“返回”按钮保存订单信息。 内容 此处显示 id "footer" 的内容 <% ArrcheckBook= Split(Session("CheckBook"),", ") BookIDList="" For I=0 To UBound(ArrcheckBook)'显示数组的最大维数 cclickBookID="'"&request("clickBookID")&"'" If ArrcheckBook(i)cclickBookID Then If Len(BookIDList) = 0 Then BookIDList =ArrcheckBook(i) Else BookIDList = BookIDList & ", " & ArrcheckBook(i) End If end if Next If len(BookIDList)=0 Then session("BookIDList")= BookIDList Response.Redirect("buycarempty.asp") Else session("BookIDList")= BookIDList Response.Redirect "buycarsee.asp" end if %> <% response.Expires=-1 username1=trim(request("username")) userpass1=trim(request("userpass")) 'response.write 41 'response.End() if username1="" or userpass1="" then session("passed")="" session("msg")="请您先登录再进来!" 'response.Redirect("userlogin.asp") else set rs=server.CreateObject("adodb.recordset") strsql="select * from tb_operator where operatorname='"&username1&"'" rs.open strsql,cnn,3,3 if rs.eof then session("passed")="" session("msg")="管理员名称不存在" else if rs("password")userpass1 then session("passed")="" session("msg")="密码错误" else session("passed")=true session("msg")="" session("username")=rs("operatorname") 'response.Redirect("userlogin.asp") end if end if end if response.Redirect("operatorlogin.asp") %> 管理员登录 function chkfields(){ if(document.myform.username.value==''){ alert("管理员名称不能为空"); document.myform.username.focus(); return false; } if(document.myform.userpass.value==''){ alert("管理员密码不能为空"); document.myform.userpass.focus(); return false; } return true; } function take(){ window.open("lookup.asp","图书库存查询"); } AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','639','height','119','src','../images/banner','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/banner' ); //end AC code 网站首页 查看购物车 会员登录 管理员登录 <% if session("msg")"" then response.write session("msg") else response.write "管理员登录" end if %> 管理员: 密码:    管理员 , 登录成功 的订单一览表 的订单一览表 订单号书号书名价格数量金额购书日期 <% rs.pagesize=7 page=CLng(Request("page")) if page        第一页 <% end if if page1 then %> 第一页 上一页 <%end if if pagers.pagecount then %> 一页 一页 <% else response.write "您没有购书记录!" end if %> <% If (Request("cValue") "" and Request("sField") "") Then If (Request("cValue") "") Then session("INvalue") = Request("cValue") End If session("pBookName") = "BookName" If (Request("sField") "") Then session("pBookName") = Request("sField") End If session("pBookName")=Replace(session("pBookName"), "'", "''") session("INvalue")=Replace(session("INvalue"), "'", "''") If (Request("mode") "") Then session("rs_mode") = Request("mode") End If end if if session("rs_mode")"" then if session("rs_mode")="==" then sql= "SELECT isbn, bookname, author, price FROM tb_book WHERE "_ + session("pBookName") + " = '" + session("INvalue") + "'" else sql = "SELECT isbn, bookname, author, price FROM tb_book WHERE "&_ session("pBookName") & " Like '%" & session("INvalue") & "%'" end if else sql="SELECT isbn, bookname, author, price FROM tb_book " end if set rs_search=Server.CreateObject("ADODB.RecordSet") rs_search.open sql,cnn,1,3 %> function newwin1(url){ var newwin=window.open(url,"","resizable=yes,scrollbars=yes,width=700,height=400"); newwin.focus(); return false; } 书号 书 名 作 者 原价 现 价 购物 alert("无符合条件的图书!") history.back(1) <%response.end() end if '分页' rs_search.pagesize=7 page=CLng(Request("page")) if page <% if page1 then %> 第一页  上一页 <%end if if pagers_search.pagecount then %>  一页  一页 无符合条件的记录!
发帖
ASP
加入

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
申请成为管理员
帖子事件
创建了帖子
2022-04-21 12:46
社区公告
暂无公告