here i am trying to get the value that is inside <td> value </td> using javascript getElementById(ID); but i am not able to fetch the value and display value in alert box.
code:
<script type="text/javascript">
function getvalue()
{
var lat = document.getElementById('lat').value;
var lon = document.getElementById('lon').value;
var lati = parseInt(lat);
var long = parseInt(lon);
alert(lati,long);
}
</script>
php-html code:
while($row = mysql_fetch_assoc($retval))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['theater_name'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td id='lat'>" . $row['lat'] . "</td>";
echo "<td id='lon'>" . $row['lon'] . "</td>";
echo "</tr>";
}
The table is auto generated by php from database table values for only one record. now i want to fetch lat and lon value in javascript and alert it.. but now i am not able to get alert...How can i do this?