急等大侠请指点!!!
我想作出如下的效果,请大侠指点:
是一个物料销售的页面,效果如下:开始有两行
标题行:货品编号 货品 商标 型号 价格 数量 总价
对应的inputbox:inbox1 inbox2 inbox3 inbox 4.....
现在想当在inputbox “货品编号”中输入编号时,通过onchange按钮,触发一个动作,去检索数据库,找出这个编号对应的记录,然后把其他商标,型号价格,信息显示在页面上,输入数量后,再通过onchange,计算出总价,显示再页面上,请问是否能做到,我目前遇到的困难是写第一个onchange的函数。
部分代码如下:
<script language= "VBScript ">
function change(para1)
{
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject( "ADODB.Recordset ")
Recordset1.ActiveConnection = MM_jxc_STRING
Recordset1.Source = "SELECT * FROM jin where hidcode like '% " + request.form( "hidcode3 ") + " ' "
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
不知道怎么写???
Recordset1.Close()
Set Recordset1 = Nothing
%>
}
</script>
.......................
<table width= "99% " border= "0 " bgcolor= "#cccccc " align= "center " cellpadding= "0 " cellspacing= "1 " id= "mytable ">
<tr bgcolor= "#eeeeee " align= "center ">
</tr>
<tr bgcolor= "#eeeeee " align= "center ">
<td width = "10% "> <div align= "center "> <strong> 货品编号 </strong> </div> </td>
<td width = "10% "> <div align= "center "> <strong> 货品 </strong> </div> </td>
<td width = "10% "> <div align= "center "> <strong> 商标 </strong> </div> </td>
<td width = "10% "> <div align= "center "> <strong> 型号 </strong> </div> </td>
<td width = "10% "> <div align= "center "> <strong> 价格 </strong> </div> </td>
<td width = "5% "> <div align= "center "> <strong> 数量 </strong> </div> </td>
<td width = "10% "> <div align= "center "> <strong> 总价 </strong> </div> </td>
</tr>
<tr bgcolor= "#FFFFFF " align= "center ">
<td colspan= "1 "> <input type= "text " name= "hidcode " size= "10 " onchange= "change() "> </td>
<td colspan= "1 "> <input type= "text " name= "hgoodsname " size= "10 "> </td>
<td colspan= "1 "> <input type= "text " name= "hshangbiao " size= "10 "> </td>
<td colspan= "1 "> <input type= "text " name= "hxinghao " size= "10 "> </td>
<td colspan= "1 "> <input type= "text " name= "jiage " size= "10 "> </td>
<td colspan= "1 "> <input type= "text " name= "shu " size= "10 "> </td>
<td colspan= "1 "> <input type= "text " name= "zongjia " size= "10 "> </td>
</tr>
</table>
..........................................
请大侠指点上面的函数怎么写?或者说不能实现的。
[解决办法]
做当然是可以做,但是要写很多代码呀。
1, 用客户端JS可以完成动态添加页面元素的任务
2. 显示相关信息的做法,就是我说的,要将item code递交的服务器然后取数据,如果你不想页面刷新,可以用ajax或者隐藏iframe的方式取的返回的数据,并用js显示在页面中.
3.建议客户端代码和服务端代码分开写,混在一起的话更困难。
[解决办法]
不过除去以上问题的话,我已经实现了通过输入商品编号,在不刷新总窗口的情况下,获得商品信息了.前段时间在外出差,看到你还没有结贴,刚回来时把你的问题给解答了.不知还要不要解答这个问题,如果不需要的话那就赶紧结贴了.
