burki
05-24-2012, 11:21 AM
hi
i want to call a javascript function when a <td> load.
i write code but it is not working.
explain any one
<head>
<script type="text/javascript">
function bgclr()
{
if(document.getElementById("ggg"))
{
document.getElementById("ggg").style.background="#cccccc";
}
}
</script>
</head>
<body ><table width="60%" border="0">
<tr>
<td title="ggg" id="foo"><script type="text/javascript">bgclr();</script></td>
<td> </td>
<td> </td></tr></table>
<div id="ggg">some text<div>
<body>
if it is possible then how can i pass the id of <td> which is "foo" to bgcle() function.
i want to call a javascript function when a <td> load.
i write code but it is not working.
explain any one
<head>
<script type="text/javascript">
function bgclr()
{
if(document.getElementById("ggg"))
{
document.getElementById("ggg").style.background="#cccccc";
}
}
</script>
</head>
<body ><table width="60%" border="0">
<tr>
<td title="ggg" id="foo"><script type="text/javascript">bgclr();</script></td>
<td> </td>
<td> </td></tr></table>
<div id="ggg">some text<div>
<body>
if it is possible then how can i pass the id of <td> which is "foo" to bgcle() function.