This is my guess as to what it is that you are trying to do.
Code:
<!DOC HTML>
<html>
<head>
<title> Untitled </title>
<script type="text/javascript">
var choices = [];
function saveSelections(info) {
if (info.value != '') {
choices.push(info.value+' : '+info.options[info.selectedIndex].text);
}
}
function showSelections() { alert(choices.join('\n')); }
</script>
</head>
<body>
<form name="myForm" action="" method="post" onsubmit="return false">
<select id="prwto" name="first" onchange="saveSelections(this)">
<option value="">Choose</option>
<option value=1>Red</option>
<option value=2>Yellow</option>
<option value=3>Blue</option>
<option value=4>Green</option>
</select>
<button onclick="showSelections()">Show choices</button>
</form>
</body>
</html>
Please use [ code] and [ /code] tags (without the spaces) around your script submissions.
Makes it a lot easier for forum readers to see and preserves formatting.
Good Luck!
Bookmarks