not getting the right index value
Posted: Mon Aug 11, 2008 11:58 am
hi there,
i'm here with a little issue, that i can't solve
,
now on the javascript, i try to get the right value but it always return the first index.
can someone help me solving this issue ?
thanks in advance
i'm here with a little issue, that i can't solve
Code: Select all
echo "<td><select id=\"message\" onChange=\"alert(this.value)\">"; // here i can get the right value everytime that i change it
while( $row1 = mysql_fetch_array($result1, MYSQL_ASSOC) ) {
echo "<option value=\"".$row1['id_message']."\">".$row1['id_message'] . "-" . $row1['desc']."</option>";
}
echo "</select></td>";
Code: Select all
var index = document.getElementById("message").selectedIndex;
alert(document.getElementById("message").options[index].value);
thanks in advance