IE10和JS的兼容性问题 RRS feed

  • 问题

  • 有段代码是这样的:

    DispAddressPrefecture.value = AddressPrefecture.options[AddressPrefecture.selectedIndex].text



    2014年1月22日 8:17


  • Hi,

    You can try this code:

    <script type="text/javascript">
            function fnChange() {
                var s = document.getElementById("oCars");
                var d = document.getElementById("oData");
                d.value = s.options[s.selectedIndex].text;
                s.options[s.options.length] = new Option("Option text", "optionValue");//work
                oData.value += oCars.options[oCars.selectedIndex].text + "\n";//undefined oData error

     <select id="oCars" onchange="fnChange()" size="1">
      <option value="1">BMW</option>
      <option value="2">PORSCHE</option>
      <option selected="" value="3">MERCEDES</option>
    <textarea id="oData"></textarea>
    I test it in ie11. So you can try using document.getElementById("oData") instead of "oData". It should work.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href=""> HERE</a> to participate the survey.

    2014年1月23日 2:37