-
Select Box Additions
Hi there, I know how to load a select box up with server side scripting.
Was wondering if it is possible to use javascript and add items to a select
box once the page is displayed at the client browser. Tried using the add
function but keep getting type mismatch.
-
Re: Select Box Additions
"Mark Taylor" <mtaylor1@cbsinc.com> wrote:
>
>Hi there, I know how to load a select box up with server side scripting.
>Was wondering if it is possible to use javascript and add items to a select
>box once the page is displayed at the client browser. Tried using the add
>function but keep getting type mismatch.
Mark,
This is to answer part two of your question. I have a better way to do this
using the IE DOM, but I don't know if you have to support Netscape also,
so I think this will work in both (sorry, but this is vbScript, shouldn't
be too hard to convert though):
'first bump up the length of the options array:
myform.cboMyCombo.options.length = myform.cboMyCombo.options.length + 1
'Now set value and text
myform.cboMyCombo.Options(myform.cboMyCombo.Options.Length - 1).Value = "CA"
myform.cboMyCombo.Options(myform.cboMyCombo.Options.Length - 1).Text = "California"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|