Hi,
If I understand you correctly, this is what you would like to do:
 
[ pseudo code ]
 
find position of link two (in pixels)
set the following properties for the div: div.top and div.left where
div.top = vertical position of link + 10 px (or however many pixels you
want)
div.left = 10 px (or however many pixels you want)
 
[ /pseudo code ]
 
The meat of this is how to find the position of the link (or any element
for that matter). Consult this link:
http://www.quirksmode.org/js/findpos.html
 
Basically, what you are looking for are the following properties:
offsetTop and offsetLeft.
 
 
Harsh.
 
-----Original Message-----
From: Ashish Kulkarni [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 02, 2006 4:30 PM
To: [EMAIL PROTECTED]; Struts Users Mailing List
Subject: Issue with DHTML and DIV position


Hi
I am attaching a html file along this mail, and also posting a shorttext
URL to view the html file
What i basically want to do is get the div with  id="showtwo" below the
2 link displayed 
Can anyone help with this issue

The code link is
http://www.shortText.com/zlj8z <http://www.shorttext.com/zlj8z> 

or you can download the html file along this mail, or the get the html
text pasted in this mail

<html>
<head>
    <title>Postion Text</title>
    <script language="JavaScript">
    function hideAll()
    {
    document.getElementById("showone").style.visibility='hidden';
    document.getElementById("showtwo").style.visibility='hidden';
    }
    function showOne()
    {
    hideAll();
    document.getElementById("showone").style.visibility='visible';
    }
    function showTwo()
    {
    hideAll();
    document.getElementById("showtwo").style.visibility='visible';
    }
    </script>
</head>

<body>
      <div id="top_div">
      <table width="100%" align="center">
      <tr >
      <td>
      <a href="javascript:showOne();">Show One</a>&nbsp; &nbsp;
      <a href="javascript:showTwo();">Show Two</a>
      </td>
      </tr>
       </table>
      </div>
      <div id="showone" style="visibility= visible; position:
relative;">
      <table width="100%" align="center">
      <tr >
      <td height="100px;">
      This is showing number one DIV
      </td>
      </tr>
       </table>
      </div>
      <div id="showtwo" style="visibility= hidden; position: relative;">
      <table width="100%" align="center">
      <tr >
      <td height="100px;">
     DIV Number 2 is showed now
      </td>
      </tr>
       </table>
      </div>

</body>
</html>



Reply via email to