<script>
function spec_sub(count){
var d = document.getElementsByName('radio');
for(var i=0;i<d.length;i++){
if(d[i].checked == true){
document.form1.defaultSpec.value = d[i].value;
}
}
regexpdat=/^/d+$/;
for(var i=0;i<count;i++){
var num=document.getElementById('num'+i);
var openPrice=document.getElementById('openPrice'+i);
var price=document.getElementById('price'+i);
if(parseFloat(price.value)>parseFloat(openPrice.value)){
alert('本店价格不能大于市场价格');
return false;
}
if(!regexpdat.test(num.value)||num.value==0){
alert('库存应为正整数');
return false;
}
}
document.form1.action='product.shtml?method=submitProductSpec';
document.form1.submit();
return false;
}
</script>
<form name="form1" method="post" action="product.shtml?method=submitProductSpec">
<table width="763" border="0" cellpadding="0" cellspacing="0">
#set($count = 0)
#foreach($pspec in $specList)
<tr>
<td class="zhright6"><input type='text' size='5' id='openPrice$!count' name='spec_${pspec.id}_openPrice' value='$!{number.format('0.00',$!pspec.openPrice)}' />
</td><!--市场价格-->
<td class="zhright6"><input type='text' size='5' id='price$!count' name='spec_${pspec.id}_price' value='$!{number.format('0.00',$!pspec.price)}' /></td>
<td class="zhright6"><input type='text' size='5' id='num$!count' name='spec_${pspec.id}_num' value='$!{pspec.num}' /></td><!--库存-->
<td class="zhright6"><a href="#" οnclick="spec_add(${pspec.id});return false;">复制</a> | <a href="#" οnclick="spec_del(${pspec.id});return false;">删除</a></td>
</tr>
#set($count = 1 + $count)
<tr>
<td colspan="9"><img src="images/zhright_xian.jpg" /></td>
</tr>
#end
</table>
<td align="left" width="68" height="18"><input type="button" class="products_set" value="保 存" οnclick="spec_sub($count);return false;" #if($count == 0) disabled #end></td>
</form>