<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<script type="text/javascript">
function showMe2(it,txtid,msg) 
{ 
document.getElementById(it).style.display = "block"; 
e=document.getElementById(it);
//e.style.top=200;
document.getElementById(it).innerHTML = msg;//document.getElementById(txtid).parentElement.offsetTop ;
e.style.top= document.getElementById(txtid).parentElement.offsetTop+35;
e.style.left=document.getElementById(txtid).parentElement.offsetLeft+200;
e.align = "left";
e.style.width="auto";
//document.getElementById(it).style.top  =document.getElementById(txtid).style.top ; 
} 
function hide(it)
{
document.getElementById(it).style.display = "none"; 
}
</script>

<body>

    <form id="form1" runat="server">

    <div>

        <br />
        <table style="width: 280px">
            <tr>
                <td style="width: 150px">
                    Enter Name
                </td>
                <td width ="30px">
                    :</td>
                <td style="width: 100px">

        <asp:TextBox ID="TextBox1" runat="server" onfocus="showMe2('div1','TextBox1','Enter name E.g. P.P.Grey')" onblur="hide('div1')"></asp:TextBox></td>
            </tr>
            <tr>
                <td >
                    Enter Age</td>
                <td>
                    :</td>
                <td style="width: 3px">
                 <div id="div1" class="dv1" style="background-color :WhiteSmoke ; position: absolute;">
                                </div>
        <asp:TextBox ID="TextBox2" runat="server" onfocus="showMe2('div1','TextBox2','Enter Age E.g. 25 yrs')" onblur="hide('div1')"></asp:TextBox></td>
            </tr>
            <tr>
                <td style="width: 63px">
                </td>
                <td>
                </td>
                <td style="width: 3px">
                </td>
            </tr>
        </table>
        </div>

    </form>

</body>
</html>

this html code work on IE but not on firefox

e.style.top= document.getElementById(txtid).parentElement.offsetTop+35;

There is no such 'parentElement' in FF. You should use 'parentNode' for FF. Not sure if IE also accepts that; otherwise, you need to check for client browser before you attempt to do so.

check for client browser...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.