Results 1 to 2 of 2

Thread: Adding option to <select>???

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    11

    Unhappy

    Hi,
    for some reason, I can't add another option to my combo box. I have:

    sub init()
    oOption = document.createElement("OPTIONS")
    oOption.text="Apples"
    oOption.value="5"
    FontName.options.add(oOption)
    end sub
    Where fontname is the name of the combo box and I want to add lets say "apples" to my list. I need to use VBScript BTW so I can use my activeX controls which need to interact with it. Anyone know what I'm doing wrong? thanks!

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    this should help you.

    Code:
    <BODY><HEAD>
    <script Language="VBScript">
    dim i
    sub ShowDetails()	
    	i = i + 1		
    	dim oOption	
    	set oOption = document.createElement("OPTION")	
    	oOption.text="Apples"	
    	oOption.value=i	
    	document.frm1.select1.add(oOption)
    end sub
    </script>
    </head>      
    
    <form name="frm1">            
    <SELECT id=select1 name=select1 size=2 style="HEIGHT: 134px; WIDTH: 258px">      
    </SELECT>              
    </form>          
    <input type="button" onclick="ShowDetails()" value="Click">          
    </BODY></HTML>
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width