Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
- <script>
- $(document).ready(function() {
- var jqposme = $("#positionme");
- var jqcell = jqposme.closest("td");
- var cellpos = jqcell.offset();
- jqposme.offset({ top: cellpos.top + 10, left: cellpos.left + 10 });
- });
- </script>
- <style>
- #positionme { background: yellow; position:absolute;padding:5px }
- </style>
- </head>
- <body>
- <br/>
- <br/>
- <table cellspacing="0" cellpadding="0" border="1" width="600" height="300">
- <tr>
- <td width="50"> </td>
- <td align="center">
- <table cellspacing="0" cellpadding="0" border="1" width="450" height="200">
- <tr>
- <td width="50"> </td>
- <td bgcolor="#9ba8dd">
- <div id="positionme">I'm positioned at 10,10<br/>relative to the blue cell</div>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment