日期:2014-05-16 浏览次数:20454 次
var hdrewardid = "commentscorestr";
function setreward(rewardid,value) {
var hdreward = document.getElementById(hdrewardid);
if(hdreward.value.indexOf("@" + rewardid +"@") > -1 ) {
var reg = new RegExp("@" + rewardid +"@\\d");
hdreward.value = hdreward.value.replace(reg,"@" + rewardid +"@" + value);
} else {
hdreward.value += "@" + rewardid +"@" + value;
}
return false;
}
<input name="commentscorestr" id="commentscorestr" type="hidden" />
<select name="score" id="score">
<option value="-1" >--请选择--</option>
<option value="5" id="reward5_11" onchange="return setreward(11,5);">非常好(5)</option>
<option value="4" id="reward4_11" onchange="return setreward(11,4);">很好(4)</option>
<option value="3" id="reward3_11" onchange="return setreward(11,3);">好(3)</option>
<option value="2" id="reward2_11" onchange="return setreward(11,2);">一般(2)</option>
<option value="1" id="reward2_11" onchange="return setreward(11,1);">差(1)</option>
</select>
<input name="commentscorestr" id="commentscorestr" type="hidden" />
<select name="score" id="score" onchange="return setreward(11,event.target.selectedIndex);">
<option value="-1" >--请选择--</option>
<option value="5" id="reward5_11" >非常好(5)</option>
<option value="4" id="reward4_11" >很好(4)</option>
<option value="3" id="reward3_11" >好(3)</option>
<option value="2" id="reward2_11" >一般(2)</option>
<option value="1" id="reward2_11" >差(1)</option>
</select>
<script>
var hdrewardid = "commentscorestr";
function setreward(rewardid,value) {
if(value===0){
return;
}
var hdreward = document.getElementById(hdrewardid);
if(hdreward.value.indexOf("@" + rewardid +"@") > -1 ) {
var reg = new RegExp("@" + rewardid +"@\\d");
hdreward.value = hdreward.value.replace(reg,"@" + rewardid +"@" + value);
} else {
hdreward.value += "@" + rewardid +"@" + value;
}
return false;
}
</script>
<select name="score" id="score" onchange="setreward(11,this.value);">
<option value="-1" >--请选择--</option>
<option value="5" id="reward5_11" >非常好(5)</option>
<option value="4" id="reward4_11" >很好(4)</opt