Announcement

Collapse
No announcement yet.

"undefined global variable:i" on javascript

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • "undefined global variable:i" on javascript

    I'm making a javascript function on blank application,
    the script is

    ?>
    <script type="text/javascript">
    window.onload = fillDropDown();

    function fillDropDown() {
    var ddl = document.getElementById( 'myDropdown' );
    var theOption = new Option;
    var x;
    var i;

    for(i = 0; i < 999; i++) {
    x = i + 1;
    theOption.text = x;
    theOption.value = x;
    ddl.options[i] = theOption;
    }
    }
    </script>

    <form id="myForm">
    <select id="myDropdown"></select>
    </form>
    <?php

    but when run the application i get the message:
    undefined global variable:i

    so why happen this and what i can do?
    i need make this application.
    thanks in advance
Working...
X