Peter Johnson
02-25-2007, 01:15 AM
I have a script that scrolls the page to a div when you click the appropriate link. I works in both FF and IE 6 & 7, but only if the page isn't contained within a table.
When it's inside a table, it only works in FF, not in IE6 or IE7. And I really need it to work inside a table. Any ideas? (Also, I'm using javascript instead of anchor tags because the page is in an iframe and anchor tags cause the entire parent page to jump, but I only want the iframe page to jump - but that's for another forum!)
Thanks in advance for any help!
Below is a simplified version of the code (including the table tags that make it not work - again, take away the table tags and it works in everyone)
<html>
<body>
<table><tr><td>
<div id="links">
<a href="javascript:void()" onclick="window.scrollTo(0,linka); return false">A</a>
<br />
<div id="linka" class="backtotop">linkA</div>
<script>
var linka = document.getElementById('linka').offsetTop;
</script>
</div>
</td></tr></table>
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
</body>
</html>
When it's inside a table, it only works in FF, not in IE6 or IE7. And I really need it to work inside a table. Any ideas? (Also, I'm using javascript instead of anchor tags because the page is in an iframe and anchor tags cause the entire parent page to jump, but I only want the iframe page to jump - but that's for another forum!)
Thanks in advance for any help!
Below is a simplified version of the code (including the table tags that make it not work - again, take away the table tags and it works in everyone)
<html>
<body>
<table><tr><td>
<div id="links">
<a href="javascript:void()" onclick="window.scrollTo(0,linka); return false">A</a>
<br />
<div id="linka" class="backtotop">linkA</div>
<script>
var linka = document.getElementById('linka').offsetTop;
</script>
</div>
</td></tr></table>
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
<p>lorum ipsum<p>lorum ipsum<p>lorum ipsum
</body>
</html>