ä¸æå表代ç å¦ä¸ï¼
<span style="font-size:12px;"><td class='tdLeftHead'>ç¨ç</td>
<td>
<select id='tax1' onchange='taxChange(this.value,1,"thirdparty_profit")' name='thirdparty_taxid'>
<s:if test="profitList[0].get('THIRDPARTY_TAXID') == -1" >
<option selected="selected" value=-1>N/A</option>
</s:if>
<s:else>
<option value=-1>N/A</option>
</s:else>
<s:iterator value="taxTypeList" status="tar_1" >
<s:set name="index" value="#tar_1.getIndex()"/>
<s:set name="id" value="taxTypeList[#index].getId()"/>
<s:set name="taxid" value="profitList[0].get('THIRDPARTY_TAXID')"/>
<s:if test="#taxid != #id " >
<option value='<s:property value="taxTypeList[#index].getId()" />' >
<s:property value="taxTypeName" />
</option>
</s:if>
<s:else>
<option selected="selected" value='<s:property value="taxTypeList[#index].getId()" />'> <s:property value="taxTypeName" /></option>
</s:else>
</s:iterator>
</select>
</td></span>
常ç¨åå¼æ¹æ³ï¼
var myselect=document.getElementById("tax"+i); // è·åä¸æå表对象
var myIndex=myselect.selectedIndex ; // è·åä¸æå表å½åç´¢å¼
var taxId = myselect.options[myIndex].value; // è·åå½åç´¢å¼å¯¹åºçoptioné项valueå¼
var taxText = myselect.options[myIndex].text; // è·åå½åç´¢å¼å¯¹åºçoptioné项ææ¬æ¡å
容å¼
å¨JSä¸æ´æ¹å±ç¤ºoptioné项æ¹æ³ï¼ä¼ å
¥ä½ æ³å±ç¤ºçé项对åºçvalueå¼å³å¯ã
$("#tax1").val(value); // éä¸ä¸æå表ï¼ç»å
¶ä¼ optioné项valueå¼ï¼å°±ä¼å±ç¤ºè¯¥valueå¼å¯¹åºç´¢å¼çå
容å¼ã
å¢å ä¸ä¸ªé项çæ¹æ³ï¼
<span style="font-size:14px;"> var option=document.createElement("option");
option.text="nami";
option.value="nami1";
var x=document.getElementById("mySelect");
try
{
x.add(option,null); // æ åå®ç°
}
catch(ex)
{
x.add(option); // ä»
å¨IEä¸å®ç°
}</span>
jqueryç¦ç¨selectååæ¶ç¦ç¨ï¼
$("#channelplatform").removeAttr("disabled");
$("#channelplatform").attr("disabled","disabled");
æ·»å å°±æ¯attr
åæ¶åæ¯reomveAttrï¼æ³¨æA大åï¼
å°å¼å
¥åè½ï¼å°ä¸å¼ æ¥å£è¡¨ä¸æ°æ®ï¼å¼å
¥å°ç¨ç表ä¸ï¼ç¸å
³JSP代ç è´´åºæ¥ï¼ä»¥åå¯ä»¥ç¿»çæä¹å¨JSä¸ååºä¸æå表ç对象åå
¶å±æ§å¼ã
<span style="font-size:14px;"> function doInto(){
var TP_TAX_RATE = $("#taxAisas1").val();
var OP_TAX_RATE = $("#taxAisas2").val();
var OS_TAX_RATE = $("#taxAisas3").val();
var TR_TAX_RATE = $("#taxAisas4").val();
var TP_AMOUNT = $("#dealAisasPrice1").val();
var OP_AMOUNT = $("#dealAisasPrice2").val();
var OS_AMOUNT = $("#dealAisasPrice3").val();
var TR_AMOUNT = $("#dealAisasPrice4").val();
$('#dealPrice1').val(TP_AMOUNT);
$('#dealPrice2').val(OP_AMOUNT);
$('#dealPrice3').val(OS_AMOUNT);
$('#dealPrice4').val(TR_AMOUNT);
var flag_TP = false;
var flag_OP = false;
var flag_OS = false;
var flag_TR = false;
var id1,id2,id3,id4;
<s:iterator value="taxTypeList" >
<s:set name="index" value="#tar_1.getIndex()"/>
<s:set name="id" value="taxTypeList[#index].getId()"/>
<s:set name="taxTypeName" value="taxTypeList[#index].getTaxTypeName()"/>
ââè¿éçid1å³ä¸ºoptioné项对åºçvalueå¼
if(TP_TAX_RATE=='<s:property value="taxTypeName" />'){
id1= '<s:property value="id" />'
flag_TP = true;
}
if(OP_TAX_RATE=='<s:property value="taxTypeName" />'){
id2= '<s:property value="id" />'
flag_OP = true;
}
if(OS_TAX_RATE=='<s:property value="taxTypeName" />'){
id3= '<s:property value="id" />'
flag_OS = true;
}
if(TR_TAX_RATE=='<s:property value="taxTypeName" />'){
id4= '<s:property value="id" />'
flag_TR = true;
}
</s:iterator>
ââç»selectedä¸ææ¡è®¾ç½®valueå¼ï¼å³å¯åæ¢ä¸ºæ们å¸æå±ç¤ºçææ¬æ¡å
容
$("#tax1").val(id1);
$("#tax2").val(id2);
$("#tax3").val(id3);
$("#tax4").val(id4);
taxChange(id1,1,"thirdparty_profit");
taxChange(id2,2,"selfserv_profit");
taxChange(id3,3,"softwareserv_profit");
taxChange(id4,4,"train_serv_profit");
if(!flag_TP){
alert(TP_TAX_RATE + 'ç¨çä¸åå¨ã');
return false;
}
if(!flag_OP){
alert(OP_TAX_RATE + 'ç¨çä¸åå¨ã');
return false;
}
if(!flag_OS){
alert(OS_TAX_RATE + 'ç¨çä¸åå¨ã');
return false;
}
if(!flag_TR){
alert(TR_TAX_RATE + 'ç¨çä¸åå¨ã');
return false;
}
} </span>
ç¨class对å¤ä¸ªä¸æå表çå¼è¿è¡éå¤æ ¡éª:
$('.company').each(function(){
var bu = $(this).parent().parent().find('.bu');
if($(this).val()!=''&&bu.val()!=''){
var company = $(this).val();
var bu = bu.val();
var bcStr = company + bu;
if(bcArray.length > 0)
{
for(var i=0;i<bcArray.length;i++)
{
if(bcArray[i] == bcStr)
{
var companySelect=$(this);
var companyIndex=companySelect[0].selectedIndex ;
var companyText = companySelect[0].options[companyIndex].text;
var buSelect = $(this).parent().parent().find('.bu')
var buIndex=buSelect[0].selectedIndex ;
var buText = buSelect[0].options[buIndex].text;
alert("ç¾çº¦æ¹:"+companyText+"åBU:"+buText+"å·²ç»åå¨ï¼è¯·æ£æ¥æ°æ®ã");
flag=false;
break;
}
}
if(flag)
{
bcArray.push(bcStr);
}
else
{
return false;
}
}
else
{
bcArray[0] = bcStr;
}
}
})
温馨提示:答案为网友推荐,仅供参考