Here's a real world example of Charlie's code...


<script type="text/_javascript_">
     function doDisabled(fld, num) {
          if (num < 2) fld.selectedIndex = 2;
     }
</script>

Internal Company Survey

How content are you with your current salary?

<select name="enjoy" this.selectedIndex);">
     <option value="1" style="color:#cccccc;
background-color:#ececec;">I REALLY NEED A RAISE</option>
     <option value="2" style="color:#cccccc;
background-color:#ececec;">THE RECEPTIONIST MAKES MORE THAN ME</option>
     <option value="3" selected="selected">VERY CONTENT</option>
     <option value="4">I MAKE TOO MUCH, TAKE SOME BACK!</option>
</select>


  ----- Original Message -----
  From: Charlie Griefer
  To: CF-Community
  Sent: Friday, July 09, 2004 5:41 PM
  Subject: Re: You have see it but you can't have it :)

  Won't pretend I understand why... but this should do you:

  <script type="text/_javascript_">
       function doDisabled(fld, num) {
            if (num < 2) fld.selectedIndex = 2;
       }
  </script>

  <select name="test" this.selectedIndex);">
       <option value="1" style="color:#cccccc;
  background-color:#ececec;">op1</option>
       <option value="2" style="color:#cccccc;
  background-color:#ececec;">op2</option>
       <option value="3" selected="selected">op3</option>
       <option value="4">op4</option>
  </select>

  ----- Original Message -----
  From: "Chunshen (Don) Li" <[EMAIL PROTECTED]>
  To: "CF-Community" <[EMAIL PROTECTED]>
  Sent: Friday, July 09, 2004 3:30 PM
  Subject: You have see it but you can't have it :)

  > Sounds simple and familiar? :)
  >
  > <select name="test">
  >    <option value="1" disabled="yes">op1
  > <option value="2" disable="true">op2
  > <option value="3">op3
  > <option value="4">op4
  > </select>
  >
  > Objective:
  > list all the 4 options, however, only the last two are selectable.
  > Do I need more coffee or ?
  >
  >
  >
  >
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to