大大们 求助href里面的quantity怎么才能得到input的value值

时间:2021-07-22 20:39:08
<div class="span1_of_1_des">
  <div class="desc1">
<h3><%=item.getName() %> </h3>
<p style="width:450px;"><%=item.getDescription()%></p>
<h5>RMB:<%=item.getPrice() %></h5>
<div class="available">
<h4>可选项:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(商品剩余:<%=item.getNumb() %>)</h4>
<ul>

<li>数量:<input  id="quantity" name="quantity" value="<%=item.getQuantity() %>" style="text-align: center;width: 93px;">
</li>
</ul>
<div class="btn_form">

<a href="<%=request.getContextPath()%>/AddShoppingCart?&id=<%=item.getId()%>& quantity=<%=item.getQuantity() %>
&name=<%=item.getName()%>&price=<%=item.getPrice()%>">
<input type="button" style="background:#555555;width: 150px;height: 35px;color: #FFFFFF" value="add to cart" title="" />
</a>

</div>
<span class="span_right"></span>
<div class="clear"></div>
</div>
     </div>
    </div>

4 个解决方案

#1


定义一个变量  用jquery取一下值  然后赋给你href里面  不知道对不对

#2


能具体一点吗?jq不熟

#3


引用 1 楼 Danishlyy1995的回复:
定义一个变量  用jquery取一下值  然后赋给你href里面  不知道对不对

能具体一点吗?最好能有个例子,jq不熟求抱

#4


解决了,谢谢坛友的帮忙

<div class="span1_of_1_des">
  <div class="desc1">
<h3><%=item.getName() %> </h3>
<p style="width:450px;"><%=item.getDescription()%></p>
<h5>RMB:<%=item.getPrice() %></h5>
<div class="available">
<h4>可选项:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(商品剩余:<%=item.getNumb() %>)</h4>
<form action="<%=request.getContextPath()%>/AddShoppingCart?id=<%=item.getId() %>&name=<%=item.getName()%>&price=<%=item.getPrice()%>"
 name="form1" id="form1" method="post">
<ul>
<li>数量:<input id="quantity" name="quantity" value="<%=item.getQuantity() %>" style="text-align: center;width: 93px;">
</li>
</ul>
<div class="btn_form">
<input type="submit" style="background:#555555;width: 150px;height: 35px;color: #FFFFFF" value="add to cart" title="" />
</div>
</form>
<span class="span_right"></span>
<div class="clear"></div>
</div>
     </div>
    </div>

#1


定义一个变量  用jquery取一下值  然后赋给你href里面  不知道对不对

#2


能具体一点吗?jq不熟

#3


引用 1 楼 Danishlyy1995的回复:
定义一个变量  用jquery取一下值  然后赋给你href里面  不知道对不对

能具体一点吗?最好能有个例子,jq不熟求抱

#4


解决了,谢谢坛友的帮忙

<div class="span1_of_1_des">
  <div class="desc1">
<h3><%=item.getName() %> </h3>
<p style="width:450px;"><%=item.getDescription()%></p>
<h5>RMB:<%=item.getPrice() %></h5>
<div class="available">
<h4>可选项:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(商品剩余:<%=item.getNumb() %>)</h4>
<form action="<%=request.getContextPath()%>/AddShoppingCart?id=<%=item.getId() %>&name=<%=item.getName()%>&price=<%=item.getPrice()%>"
 name="form1" id="form1" method="post">
<ul>
<li>数量:<input id="quantity" name="quantity" value="<%=item.getQuantity() %>" style="text-align: center;width: 93px;">
</li>
</ul>
<div class="btn_form">
<input type="submit" style="background:#555555;width: 150px;height: 35px;color: #FFFFFF" value="add to cart" title="" />
</div>
</form>
<span class="span_right"></span>
<div class="clear"></div>
</div>
     </div>
    </div>