jave web 购物车中的超链接如何带着修改后的参数跳转? 既然是修改,为什么不直接前台修改完了,最后再提交服务器保存呢?如果一定要实时更新数据库,那就用AJAX吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 以下写的是每秒跳转一次 你试试 我也是初学者function updateMe(url) { var quantity= document.getElementById("quantity").innerHTML; if(quantity > 0) { quantity--; document.getElementById("quantity ").innerHTML = delay; } else { window.top.location.href = url; } setTimeout("updateMe('" + url + "')", 1000);}然后在<script>标签中调用这个函数。 这个问题我觉得要用键或者集合去做。hashmap以下是我用HashMap做的一些代码,不完全。但估计你可以得到提示:比较简单。脚本代码。<body> <% String username=(String)session.getAttribute("username"); HashMap<Integer,Integer> mapCar=(HashMap)session.getAttribute(username); if(mapCar==null) mapCar=new HashMap<Integer,Integer>(); String prices[]=request.getParameterValues("price"); String counts[]=request.getParameterValues("count"); String names[]=request.getParameterValues("name"); for(int i=0;i<names.length;i++) { names[i]=new String(names[i].getBytes("ISO8859-1"),"gb2312"); } int totalPrice=0; int sum=0; for(int i=0;i<counts.length;i++) { if(!counts[i].equals("")) { int count=Integer.parseInt(counts[i]); int price=Integer.parseInt(prices[i]); int unit=count*price; totalPrice+=unit; mapCar.put(i,i); session.setAttribute(username,mapCar); } for(int j=0;j<counts.length;j++) { if(names[i]==names[j]) { } } } %> IE6没问题的:<script type="text/javascript"> function updateMe(){ var quantity=document.getElementById('quantity').value; alert(quantity); } </script> <input type="text" name="txtquantity" value="3" size="1" id="quantity"> [ <a href="javascript:updateMe()">修改 </a>] 数据中带有换行时,json怎么读取 关于function的问题 jQuery UI datepicker jquery问题 DIV置顶的问题,FF是好的,但是IE6有问题,不解 如何在本地利用javascript解压缩gzip文件 js 片段调用外部 js,如何赋值,在线等! 谁帮我看看这个网页里的那张图片的真实地址? 想问问大家,showmodaldialog可不可以加上滚动条啊? JS能够获取变量的变量名么? 关于jquery的lavalamp和ingrid插件 javascript 给TD添加子控件的问题,求救
function updateMe(url) {
var quantity= document.getElementById("quantity").innerHTML;
if(quantity > 0) {
quantity--;
document.getElementById("quantity ").innerHTML = delay;
} else {
window.top.location.href = url;
}
setTimeout("updateMe('" + url + "')", 1000);
}
然后在<script>标签中调用这个函数。
以下是我用HashMap做的一些代码,不完全。但估计你可以得到提示:比较简单。脚本代码。
<body>
<%
String username=(String)session.getAttribute("username");
HashMap<Integer,Integer> mapCar=(HashMap)session.getAttribute(username);
if(mapCar==null)
mapCar=new HashMap<Integer,Integer>();
String prices[]=request.getParameterValues("price");
String counts[]=request.getParameterValues("count");
String names[]=request.getParameterValues("name");
for(int i=0;i<names.length;i++)
{
names[i]=new String(names[i].getBytes("ISO8859-1"),"gb2312");
}
int totalPrice=0;
int sum=0;
for(int i=0;i<counts.length;i++)
{
if(!counts[i].equals(""))
{
int count=Integer.parseInt(counts[i]);
int price=Integer.parseInt(prices[i]);
int unit=count*price;
totalPrice+=unit;
mapCar.put(i,i);
session.setAttribute(username,mapCar);
}
for(int j=0;j<counts.length;j++)
{
if(names[i]==names[j])
{
}
}
}
%>
function updateMe(){
var quantity=document.getElementById('quantity').value;
alert(quantity);
}
</script>
<input type="text" name="txtquantity" value="3" size="1" id="quantity">
[ <a href="javascript:updateMe()">修改 </a>]