Loading ...
Sorry, an error occurred while loading the content.

Re: [JavaScript] Re: Select.innerHTML not working in IE?

Expand Messages
  • Alligator
    That explains it ! :-) Thanks a lot!!.... anyway I figured I better make my server return a xml document with the options and then use more JS to populate the
    Message 1 of 4 , Aug 1, 2007
    • 0 Attachment
      That explains it ! :-)

      Thanks a lot!!.... anyway I figured I better make my server return a xml document with the options and then use more JS to populate the select control.

      Thanks


      Alligator_666


      Paul Donahue <scramjetter@...> wrote: Hi,

      This is a known bug in IE:

      http://support.microsoft.com/kb/276228

      There are several work arounds but rather than make one long post I
      figured I'd just find the link and post it.

      Paul

      --- In JavaScript_Official@yahoogroups.com, "Alligator"
      <alligator_666@...> wrote:
      >
      > Hello,
      > I've been trying to populate a <select> control with some
      dynamically
      > generated <option> tags (returned by some Ajax calls).
      > This works perfectly in Firefox, however it does not work in IE.
      > I have reduced the script (and the issue) to the code listed bellow,
      > if you run the code in FF it works, if you run the same thing in IE,
      > it doesn't (remember that for some reason Yahoo likes to add some
      > spaces in code listings like the one bellow).
      > Also, if you uncomment the alert line in the JS function, you'll see
      > that IE is truncating the first opening <option> tag:
      >
      >
      > <html>
      > <head>
      > <script type='text/javascript'>
      > function rewrite()
      > {
      > var ddl = document.getElementById
      ('select1');
      > var tx = '<option value="1"
      selected="selected">Option No.
      > 1</option><option value="2">Option No. 2</option><option
      > value="3">Option No. 3</option>';
      > ddl.innerHTML = tx;
      > //alert(ddl.innerHTML);
      > }
      > </script>
      > </head>
      > <body>
      > <form name='form1' id='form1'>
      > <label for='select1' onclick='rewrite
      ()'>Select Box:</label>
      > <select id='select1' />
      > </form>
      > </body>
      > </html>
      >
      >
      >
      > Thanks for your help.
      >
      >
      > Alligator_666
      >






      ---------------------------------
      Pinpoint customers who are looking for what you sell.

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.