Javascript populating dropdown

Ok, i have a drop down that is populating via Javascript (because i don’t want to write down all the numbers:)). It loads great but i would like to be able to set the “selected” option to the last item on the list (99). I have tried a number of ways but it will not work.

here’s some code:

<select name="agemax" onchange="MM_jumpMenu('parent',this,1)">
   <script language="javascript">
      var i=18;
      if (i!=99){
         document.write("<option selected='selected'>99</option>")

Any ideas on how to do this?