可按Ctrl+D收藏 蚂蚁资源网

蚂蚁资源网

购物车源码(美图源码)

  • 全部评论(3)
  • 知了科技
  • 我发个经典的,建议你去文库找下<td><input type="button" onclick="javascript:document.form1.action='update.asp?rowcount=<%=i%>&pid=<%=rs(1)%>&pcount=<%=rs(3)%>';document.form1.submit();"value="确认修改"></td>改为<td><input type="button" onclick="javascript:document.form1.action='update.asp?id=<%=rs("Id")%>&rowcount=<%=i%>';document.form1.submit();"value="确认修改"></td><%'这里需要注意在上个页面,有个i值,在这里就用到了,你要指明修改的是哪一行记录......response.redirect("mycar.asp")'执行完之后重新跳转到mycar.asp%> 改为<%'只需商品id和修改后的数量值dim idid=request.querystring("id")pcount=request.querystring("pcount")sql="update buy set pcount ='"&pcount&"' where Id="&idconn.execute sqlconn.closeset conn=nothingresponse.redirect("mycar.asp")'执行完之后重新跳转到mycar.asp%>
  • 2021-02-21 22:20:03
  • 世源网络科技
  • 只要卖家开店,每种商品就可以采用购物车的形式提供给买家购买啊,买家只要在浏览时选择购物车就可以了,每个选择的宝贝都会储存在购物车里面
  • 2021-02-11 19:10:46
  • 黑客帝国
  • jsp购物车代码,//shopping.html<html> <head><title>shopping stor</title></head> <body> <form action="carts.jsp" target="post"> <br> please select the item that you want to buy <br> <select name="item"> <option>book:old man and the sea <option>x-box game machine <option>mp3 player <option>cce <option>book:jsp programming <option>cd "the endless love" <option>dvd "gone with the wind" </select> <br> <input type="submit" name="submit" value="add"> <input type="submit" name="submit" value="remove"> </form> </body></html>------------------------------------------------------------------//carts.jsp<%@page contentType="text/html;charset=ISO8859_1" %><html> <jsp:useBean id="cart" scope="session" class="test.DummyCart"/> <jsp:setProperty name="cart" property="*"/><% cart.processRequest(); %> <br> <ol> you have chosen these items: <% String []items=cart.getItems(); for(int i=0;i<items.length;i++) { %> <li><%=items[i] %></li> <% } %> </ol> <hr> <%@include file="shopping.htm" %></html>---------------------------------------------------------------------//DummyCart.javapackage test;import javax.servlet.http.*;import java.util.Vector;import java.util.Enumeration;public class DummyCart{ Vector v = new Vector(); String submit=null; String item= null; private void addItem(String name) { v.addElement(name); } private void removeItem(String name) { v.removeElement(name); } public void setItem(String s) { item=s; } public void setSubmit(String s) { submit=s; } public String[] getItems() { String []s=new String[v.size()]; v.copyInto(s); return s; } public void processRequest() { if(submit==null) addItem(item); if(submit.equals("add")) addItem(item); else if (submit.equals("remove")) removeItem(item); reset(); } private void reset() { submit=null; item=null; }}----------------------------------------------------------------------上面是一个简单的例子,功能都能实现,对网页效果要求更漂亮些的可做一些修改。
  • 2021-02-11 19:10:46
  • 商品推荐