This is the jsp code..
<div id="content">
<table id="ddReferences" cellpadding="15" style="text-align: center;" BORDER=1 CELLSPACING=1 RULES=ROWS FRAME=HSIDES>
<tr >
<th>Type</th>
<th>Product Name</th>
<th>Model</th>
<th>Company</th>
<th>Price</th>
<th>Quantity</th>
</tr>
<% while(rst.next()){%>
<tr>
<td><%=rst.getString(1) %></td>
<td><%=rst.getString(2) %></td>
<td><%=rst.getString(3) %></td>
<td><%=rst.getString(4) %></td>
<td>Rs. <%=rst.getString(5) %></td>
<td><input type="text" name="quantity" value="1" size="3"></td>
<td><input type="button" name="add" value="Add To Cart" onclick="add(<%=rst.getInt("proID") %>, <%=rst.getInt("userID")%>)"></td>
<td><input type="button" name="buy" value="Buy Now"></td>
<%} %>
</table>
<form name="formx" method="get" action="Forward.jsp">
user<input type="text" name="nuser" value=""/>
prod<input type="text" name="nprod" value=""/>
<input type="hidden" name="nquan" value=""/>
</form>
</div>
javascript code is:
function add(prod, user){
var a = prod;
var b = user;
document.formx.nuser.value = a;
document.formx.nprod.value = b;
var refTab = document.getElementById('ddReferences');
var node = refTab.rows[1].cells[5].getElementByTagName("input")[0].getElementById("in");
var input = node.value;
document.formx.nquan.value = input;
document.formx.submit();
}

New Topic/Question
Reply


MultiQuote







|