Web Analytics Made Easy -
StatCounter dynamic generated DropDOwn value not captured in IE - CodingForum

Announcement

Collapse
No announcement yet.

dynamic generated DropDOwn value not captured in IE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic generated DropDOwn value not captured in IE

    hi Peers,

    i am having issue capturing the value of the selected DDL using IE.
    the code below works just fine in Firefox...


    // Create a new drop down list -- for text box use 'input' instead of 'select'
    var newDDL = document.createElement('select');

    // size lenght of the DDL for both IE or Firefox
    newDDL.setAttribute("style","width:300px");
    //firefox
    newDDL.setAttribute("width","300px");
    newDDL.style.width = "300px";
    newDDL.id = 'id' + elementid + ColumnElement;
    newDDL.setAttribute('name','newDDL'+ elementid+ColumnElement);

    // filling the DDL by ITEM array Elements
    var i=0;
    for (i=0;i<=rec_count;i++)
    {
    objOption = document.createElement('option')
    objOption.text = ITEM[i]
    newDDL.options.add(objOption)
    }

    counter++;
    newDDL.onchange = show1;

    both cases are giving the value selected in firefox

    function 1:
    function show1()
    {
    alert('id=' + this.getAttribute('id') + 'name = ' + this.getAttribute('name') + 'value=' + this.value );

    }

    function 2:
    function show1()
    {
    alert('id=' + this.getAttribute('id') + 'name = ' + this.getAttribute('name') + 'value='+ this.getAttribute('value'));

    }


    any suggestion will be appreciated
    thanks

  • #2
    Try assigning a value, which I.E. expects:
    Code:
    for (i=0;i<=rec_count;i++) // "<=" ?
    {
      objOption = document.createElement('option')
      objOption.text = ITEM[i];
      objOption.value = ITEM[i];
      newDDL.options.add(objOption);
    }

    Comment


    • #3
      Thank Calvert ,

      That did the job. i completely did not see that one.

      thanks again

      Comment

      Working...
      X