putha
10-13-2011, 03:08 PM
Hi all,
I am having a problem converting a physical string to a integer. I have a dropdown list of a few items but are numbers though in chracters. I ned to output the value and the text of the selected item. As I cannot use a if-else statement, any help would be great.
<select id="std_num" onchange="displayValue()">
<option value="Two">Two</option>
<option value="Zero">Zero</option>
<option value="Five">Five</option>
<option value="Three">Three</option>
<option value="Two">Two</option>
<option value="Zero">Zero</option>
</select>
function displayValue()
{
alert(document.getElementById('std_num').value);
var c = (document.getElementById('std_num').value);
}
I am having a problem converting a physical string to a integer. I have a dropdown list of a few items but are numbers though in chracters. I ned to output the value and the text of the selected item. As I cannot use a if-else statement, any help would be great.
<select id="std_num" onchange="displayValue()">
<option value="Two">Two</option>
<option value="Zero">Zero</option>
<option value="Five">Five</option>
<option value="Three">Three</option>
<option value="Two">Two</option>
<option value="Zero">Zero</option>
</select>
function displayValue()
{
alert(document.getElementById('std_num').value);
var c = (document.getElementById('std_num').value);
}