日期:2014-05-16 浏览次数:20732 次
<td>
${g.newPrice}<input type="hidden" class="oneprice" value="${g.newPrice}">
</td>
<td><input type="button" value=" - "
size="3" class="l_i" id="lost">
<input value="1"
size="2" id="number" maxlength="2" name="buynumbers"
class="number"
onkeyup="this.value=this.value.replace(/[^\d]/g,'') ">
<input type="button" value=" + " size="3" id="add" class="a_i">
</td>
<td><input value="${g.newPrice}"
id="all" class="all" name="totalprice_one" readonly="readonly"
disabled="disabled"></td>
<td>
<table>
<tr>
<td>
<input type="button" value="+" onclick="show_num('input_0',this)"/>
</td>
<td>
<input type="text" value="1" id="input_0"/>
</td>
<td>
<input type="button" value="-" onclick="show_num('input_0',this)"/>
</td>
</tr>
<tr>
<td>
<input type="button" value="+" onclick="show_num('input_1',this)"/>
</td>
<td>
<input type="text" value="1" id="input_1"/>
</td>
<td>
<input type="button" value="-" onclick="show_num('input_1',this)"/>
</td>
</tr>
<tr>
<td>
<input type="button" value="+" onclick="show_num('input_2',this)"/>
</td>
<td>
<input type="text" value="1" id="input_2"/>
</td>
<td>
<input type="button" value="-" onclick="show_num('input_2',this)"/>
</td>
</tr>
</table>
function show_num(input_id,item){
var target=document.getElementById(input_id);
var sign=item.value;
console.log(sign);
var val=parseInt(target.value);
if(sign=="+"){
val=val+1;
}else{
val=(val-1)>0?(val-1):0;
}
target.value=val;
}