Guest User

Untitled

a guest
May 17th, 2011
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html>
  3. <head>
  4. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
  5. <script>
  6.  
  7. $(document).ready(function() {
  8.  
  9. var jqposme = $("#positionme");
  10. var jqcell = jqposme.closest("td");
  11. var cellpos = jqcell.offset();
  12.  
  13. jqposme.offset({ top: cellpos.top + 10, left: cellpos.left + 10 });
  14.  
  15. });
  16.  
  17. </script>
  18. <style>
  19. #positionme { background: yellow; position:absolute;padding:5px }
  20. </style>
  21. </head>
  22. <body>
  23.  
  24. <br/>
  25. <br/>
  26. <table cellspacing="0" cellpadding="0" border="1" width="600" height="300">
  27. <tr>
  28. <td width="50">&nbsp;</td>
  29. <td align="center">
  30.  
  31. <table cellspacing="0" cellpadding="0" border="1" width="450" height="200">
  32. <tr>
  33. <td width="50">&nbsp;</td>
  34. <td bgcolor="#9ba8dd">
  35. <div id="positionme">I'm positioned at 10,10<br/>relative to the blue cell</div>
  36. </td>
  37. </tr>
  38. </table>
  39.  
  40. </td>
  41. </tr>
  42. </table>
  43.  
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment