add item in listbox in vbscript 
Author Message
 add item in listbox in vbscript

hello
   Would you mind tell me how to add item in listbox ( HTML
<SELECT></SELECT> ) in VBScript.I had used the <listboxname>.add(item,)  
function to add some item in the listbox,but the <item> can not be  a
string ,and I don't know how to create a item object in vbscript .
   Thanks in advance.
                              yours
                                      snake

--
Posted via CNET Help.com
http://www.*-*-*.com/



Mon, 03 Jun 2002 03:00:00 GMT  
 add item in listbox in vbscript
  objOption = document.createElement('OPTION');
  objOption.text = 'My Text;
  objOption.value = 'MyValue';
  frmForm.cboCombo.add (objOption);


Mon, 03 Jun 2002 03:00:00 GMT  
 add item in listbox in vbscript

Quote:

>   objOption = document.createElement('OPTION');
>   objOption.text = 'My Text;
>   objOption.value = 'MyValue';
>   frmForm.cboCombo.add (objOption);

dear Adrian Forbes:
   Thanks for your help.with your help,I write the following codes:
<form name="frmform" >
<select name="cbocombo">
<option>
<option>hello
</select>
</form>
<script language=vbscript>
dim objoption

set  objOption = document.createElement ("OPTION")
  objOption.text = "My Text"  
objOption.value = "MyValue"

 frmForm.cboCombo.add (objOption)
 window.alert  document.url
 </script>
it works very well.I am very glap to have your help , thanks again!
   best regards        
            yours  
      snake

--
Posted via CNET Help.com
http://www.help.com/



Tue, 04 Jun 2002 03:00:00 GMT  
 add item in listbox in vbscript
Snake,

You first need to create the <option> object.

Set objOpt = document.createElement("OPTION")

Specify the value and text to the Option Object

objOpt.value ="Value1"
objOpt.text = "Text"
objOpt.Id = "ID"

Then to add that particular Option Object, add to the Select Object

SomeSelectObject.options.add(objOpt)

Hope this helps,
Mark Holman


Quote:
> hello
>    Would you mind tell me how to add item in listbox ( HTML
> <SELECT></SELECT> ) in vbscript.I had used the <listboxname>.add(item,)
> function to add some item in the listbox,but the <item> can not be  a
> string ,and I don't know how to create a item object in vbscript .
>    Thanks in advance.
>                               yours
>                                       snake

> --
> Posted via CNET Help.com
> http://www.help.com/



Sun, 09 Jun 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. add item in listbox in vbscript

2. Add/remove item from listbox with VBScript?

3. add item to listbox

4. How to add and remove items between two listboxes

5. Add a listbox item

6. Add a item in a ListBox

7. How to move Listbox Items to another Listbox

8. Add items to ListBox with VBA

9. Adding an item to a listbox?

10. Adding Listbox-items from a file

11. How to add item to MultiColumn ListBox

12. Add new listbox item to an existing array

 

 
Powered by phpBB® Forum Software