Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display the items in the selected box

Status
Not open for further replies.

jsgoober

Programmer
Jan 3, 2002
12
US
Hi I am new at this forum and also new with JavaScript.

What I would like to have is a sample of javascript that
will display 3 items as a select box with Multiple="true"
and then once the user finished selecting some items,
I would like to know what items the user had selected.

Also what is the better language to use for Web dev
language, ie., VBSCRIPT or JAVASCRIPT?

Thanks for the help.
 
hi

>>sample of javascript that
will display 3 items as a select box with Multiple="true"
why javascript? you'd have to write it into a layer (either using DOM technique or trhu innerHTML or using document.write (for netscarp4x))
why won't you just make a html file with that select list?

>>I would like to know what items the user had selected.try this:
<script>
function checkit(_form,_selobjname){
var svs=[]
var ttemp=_form[_selobjname].options.length
for (var ii=0; ii<ttemp; ii++){
if (_form[_selobjname].options[ii].selected == true){
svs[svs.length]=_form[_selobjname].options[ii]
}
}
alert(svs)
}
</script>

...

<form name=&quot;f1&quot; ..>
..
choose how would you scream when this example would (at last) be working:
<select name=&quot;selm&quot; multiple size=3 onchange=&quot;checkit(this.form,this.name)&quot;>
<option selected value=wow>wow
<option value=woow>woow
<option value=yaahoo>yaahoo
<option value=weehaaa>weehaaa
</select>

what about javascript & vbscript - vbscript is microsoft feature (came from visual basic script) & would work in ie's only afaik.. javascript (i mean jscript too) would work in others too.. Victor
 
You brought some good points, but as goober as I am,
I'm just trying to learn what language would be
compatible with most browsers.

What I will be doing is pulling data from the database
into a listbox and then the user can select items from
there.

I would much prefer vbscript since I know VB but it does
not work with other browsers so that is why I am learning
jscript to see how it works.

Again, thanks for your help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top