Refer to the msdn dhtml reference library.. There are a number of
functions that enable you to add options to select boxes. For instance,
this works in IE..

        oElement = document.createElement("OPTION");
        
document.all.selectboxname.children(0).insertAdjacentElement("BeforeBegi
n",oElement);
        oElement.innerText = 'whatever';
        oElement.value = 'whatever';

Hope this helps.

Darryl

-----Original Message-----
From: Yager, Brian T Contractor/NCCIM
[mailto:[EMAIL PROTECTED]] 
Sent: Friday, 22 February 2002 7:48 AM
To: CF-Talk
Subject: RE: Any Javascript people out there? I need help with select bo
xes...


I tried that and got this error...


selectCtrl.options[i] has no properties.


Brian Yager
President - North AL Cold Fusion Users Group
Sr. Systems Analyst
NCCIM/CIC
[EMAIL PROTECTED]
(256) 842-8342


-----Original Message-----
From: Brian Rosenstock [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 3:48 PM
To: CF-Talk
Subject: RE: Any Javascript people out there? I need help with select 
bo
xes...


I think you'd need to do:

selectCtrl.options[i].value = i+1;
selectCtrl.options[i].text = i+1;

instead of just:

selectCtrl.options[i] = i+1;


Brian Rosenstock
-----Original Message-----
From: Yager, Brian T Contractor/NCCIM
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 4:39 PM
To: CF-Talk
Subject: OT: Any Javascript people out there? I need help with select 
bo
xes...


sorry about the OT post..I need help with a select box.  I am making 2
select boxes (Month and Day).  when the user changes the month, I want
the javascript to delete what is in the day select box and fill it with
the number of 
days
in
that month.  I have the deleting part working.  It just won't add.  I'm 
not
sure
what I need to do.  Here is my code(Please ignore that I HAVE to use 
ASP for
this)..


<select name="month" size="1"
onChange="changeMonth(this.form,this.form.day,this.form.month.options[
this.f
orm.
month.selectedIndex].value);">
        <option value="1" SELECTED>January</option>
        <option value="2">February</option>
        <option value="3">March</option>
        <option value="4">April</option>
        <option value="5">May</option>
        <option value="6">June</option>
        <option value="7">July</option>
        <option value="8">August</option>
        <option value="9">September</option>
        <option value="10">October</option>
        <option value="11">November</option>
        <option value="12">December</option>
        </select></td>
        <td>Day:</td><td><select name="day" size="1">
        <%for i = 1 to 31%>
        <option value="<%=i%>"><%=i%></option>
        <%next%></select></td>



<script language="JavaScript1.2">


function changeMonth(theform,selectCtrl,iValue) {
var oNewOption;
iSelection = iValue;

iOptLen=selectCtrl.length + 1;

for (i=0;i<=iOptLen;i=i+1) {

  selectCtrl.options[0] = null;


  }

if (iSelection == "1" || iSelection == "3" || iSelection == "5" ||iSelection=
"7" || iSelection == "8" || iSelection == "10" || iSelection 
== "12") {
  for (i=0;i<=30;i=i+1) {
    selectCtrl.options[i] = i+1;
        }

}
if (iSelection == "2") {
  for (i=0;i<=27;i=i+1) {
    selectCtrl.options[i] = i+1;
        }
}
if (iSelection == "4" || iSelection == "6" || iSelection == "9" ||iSelection=
"11") {
  for (i=0;i<=29;i=i+1) {
    selectCtrl.options[i] = i+1;
        }

}



}



</script>



 Someone please drop me a line and tell me what I am doing wrong.  I am
absolutely clueless....



Thanks,


Brian Yager
President - North AL Cold Fusion Users Group
Sr. Systems Analyst
NCCIM/CIC
[EMAIL PROTECTED]
(256) 842-8342



______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to