Hi, i have the following script
<html>
<head>
<script type="text/javascript">
function displayResult()
{
var x=document.getElementById("mySelect").selectedIndex;
var y=document.getElementById("mySelect").options;
document.getElementById('result').innerHTML = "You have selected " + y[x].text;
}
function displayResult2()
{
var x=document.getElementById("volume").selectedIndex;
var y=document.getElementById("volume").options;
document.getElementById('result2').innerHTML = "You chose " + y[x].text;
}
</script>
</head>
<body>
<form>
Select Drink<br>
<select multiple="yes" size="7px" id="mySelect">
<option>Coke</option>
<option>Fanta</option>
<option>Mount Franklin</option>
<option>Sprite</option>
<option>Lift</option>
<option>Golburn Valley</option>
<option>Mountain Dew</option>
</select>
<button type="button" onclick="displayResult()">Display index</button>
select quantity
<select multiple="yes" size="7px" id="volume">
<option>375ml</option>
<option>600ml</option>
</select>
<button type="button" onclick="displayResult2()">Display index</button>
</form>
<!--<p>This machine is out of order. a cal has been placed</p>-->
<p id="result"></p>
<p id="result2"></p>
<p id="error"></p>
</body>
</html>
I want to have it so that the 2 joins ina single sentence like "you have chose "drink" which is "how many mls" Any ideas?