2013年10月29日星期二

In IE, select the onchange event failure

project site there is a strange question , select the onchange event fails, can not trigger an event , but if the change will be able to trigger the onChange , do not know what the reasons are , hope you peer help, thank you ! ~
two machines in the field of IE7 and IE8, will be such a phenomenon, but in the local development environment but can not reproduce .

select is added dynamically on js dynamically add code :

function newEvent(index){
newEventIndex=index+1;
return "<tr height=23><td style=\"text-align:center;\"><input type=\"checkbox\" name=\"eventCheck\"/>" +
"<input name=\"eventList["+index+"].profileId\" value=\""+profileId+"\" type=\"hidden\"/>"+
"<input name=\"eventList["+index+"].eventId\" value=\"\" type=\"hidden\"/>"+
"</td>"+
"<td style=\"text-align:center;\"><input name=\"eventList["+index+"].produce\" value=\"true\" type=\"checkbox\"/></td>"+
"<td style=\"text-align:center;\"><input name=\"eventList["+index+"].eventName\" type=\"text\" size=\"10\" value=\"<s:text name='scriptmonitor.js.tolerantEvent'/>"+newEventIndex+"\"/></td>"+
"<td style=\"text-align:center;\"><select name=\"eventList["+index+"].lvel\">"+
<s:iterator value="levels" >
"<option value=\"${key}\">${value}</option>"+
</s:iterator>
"</select></td>"+
"<td style=\"text-align:center;\"><select name=\"eventList["+index+"].priority\">"+
<s:iterator value="prioritys" >
"<option value=\"${key}\">${value}</option>"+
</s:iterator>
"</select></td>"+
"<td style=\"text-align:center;\">"+
"<span><select name=\"eventList["+index+"].metricId\" style=\"width:80px\" onchange='selectCondition("+index+")' id='condition"+index+"'>"
+"<option value='-1'><s:text name='scriptmonitor.js.pleaseChoose'/></option>"+
<s:iterator value="scriptMetricList" >
"<option value=\"${metricId}\" jsName=\"${dataType}\">${metricName}</option>"+
</s:iterator>
"</select></span>"+
"<span id=\"relationSpan"+index+"\" style=\"padding-left:4px;\"><select id=\"operateModeId"+index+"\" name=\"eventList["+index+"].operateMode\" style=\"width:60px;\" validate=\"select-one\"/></span>"+
"<span id=\"synSpan"+index+"\" style=\"padding-left:2px;\"><input id=\"thresholdText"+index+"\" type=\"text\" name=\"eventList["+index+"].threshold\" size=\"12\"/></span>"+
"</td>"+
"<td style=\"text-align:center;\"><select name=\"eventList["+index+"].produceMode\" validate=\"select-one\">"+
<s:iterator value="produceRules">
"<option value=\"${key}\">${value}</option>"+
</s:iterator>
"</select></td>"+
"<td style=\"text-align:center;\"><input name=\"eventList["+index+"].alarm\" value=\"true\" type=\"checkbox\"/></td></tr>";
}


generated after html:

<select name="eventList[0].metricId" id="condition0" style="width: 80px;" onchange="selectCondition(0)" jQuery1382682857232="379">

------ Solution ------------------------------------- -------
seems to have browser compatibility problems , I hope to help you.
http://blog.csdn.net/huli870715/article/details/7887818
------ For reference only ----------------- ----------------------

Thank you ! Although there is no cause, but still thank you very much .

没有评论:

发表评论