Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: how can i

  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Location
    india,bangalore
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how can i

    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>

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    495
    Thanks
    0
    Thanked 82 Times in 80 Posts
    Code:
    tds[i].onmouseover = function()
    {
    this.style.border = "1px solid #000";
    alert(this.firstChild.nodeName);
    };

  • #3
    New to the CF scene
    Join Date
    Jan 2009
    Location
    india,bangalore
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks a lot


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •