...

View Full Version : how can i



navkrish
01-22-2009, 05:28 AM
hi all

please check the below code. the alert is working fine in onload. but how can i do the same when i mouse over to the particular <td>. please help me on this.

<HTML>
<HEAD>
<script>
var objBody;
var objDiv;
var anchorText;
var objLink;
var newChild;
var allTds = new Array();
window.onload=function(){
var tds=document.getElementsByTagName('td');
for (var p=0;p<tds.length ;p++)
{
allTds[p]=document.getElementsByTagName('td')[p];
alert(allTds[p].firstChild.nodeName);
}
for ( var i = 0; i < tds.length; i++ )
{
tds[i].onmouseover = function()
{
this.style.border = "1px solid #000";
};
tds[i].onmouseout = function()
{
this.style.border = "1px none";
return true;
};
}
}
</script>
</HEAD>
<BODY>
<table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td><img src="images/thumb1.jpg" height="120" width="120" border="0"></td><td>Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy</td></tr>
<tr><td colspan="2">Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy Dummy Copy</td></tr>
</table>
</BODY>
</HTML>

Fang
01-31-2009, 08:52 PM
tds[i].onmouseover = function()
{
this.style.border = "1px solid #000";
alert(this.firstChild.nodeName);
};

navkrish
02-02-2009, 04:41 AM
thanks a lot



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum