PDA

View Full Version : How to checkwhether the mulitple listbox is being selected?


yeen83
08-09-2002, 09:31 AM
How to checkwhether the mulitple listbox is being selected? so that i can according to what value of the listbox to selected to open up another window.

mordred
08-09-2002, 10:11 AM
Do you mean checkboxes like from <input type="checkbox">, radio boxes like <input type="radio"> or the selected options of a select list, like <select><option>?

yeen83
08-10-2002, 10:57 AM
it is in <select><option> and multiple style.

RadarBob
08-11-2002, 04:00 AM
Try this out for size. put the actual URL in the "value= " clause in each <option>, then you must loop through all the options checking for which ones are selected.


<script language="javascript" ....>
function openWindows (theURLs) {
for (var i=0; i<theURLs.length; i++) {
if (theURLs.options[i].selected) {
window.open (theURLs.value, ....);
}
}
} // function openWindows()
</script>

<body .... onsubmit="openWindows(theform.WindowJumper)">

<form name="theform" ....>
<select multiple name="WindowJumper">
<option value="http://www.apple.com">Apple Inc.<option>
<option value="http://www.hp.com">Hewlett Packard<option>
</select>

yeen83
08-13-2002, 06:33 AM
What does the "Theurls" mean?

RadarBob
08-13-2002, 12:58 PM
Originally posted by yeen83
What does the "Theurls" mean?

It's just a name. I made it up. I was thinking; function is basically getting a list of URLs (e.g. the web site addresses), passed to it; so I called the list "theURLs".