Print Page | Close Window

Whole Win.moves when bookmark is clicked

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12910
Printed Date: 01 April 2026 at 5:16pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Whole Win.moves when bookmark is clicked
Posted By: vshriniwasan
Subject: Whole Win.moves when bookmark is clicked
Date Posted: 09 December 2004 at 11:04pm
I have a simple Page. I have an iframe in the page. I frame is long and can span up three pages.
 
I have book marks set in the page. From the top page I use javascript to point to bookmarks inside the iframe which works without any problems.
 
When I click the book marks inside the iframe more times than ever it moves the Parent window little bit down.
 
Hope I am making sence. Is there any way to solve this problem?
 
Thanks,
Shrini



Replies:
Posted By: dpyers
Date Posted: 10 December 2004 at 7:38pm
can you post a url?

-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: vshriniwasan
Date Posted: 11 December 2004 at 12:16pm
It is an internal site. Here is an example of the code.
 
Create two files (top.htm, test.htm) both in same location. Copy the source into the file.
 
top.htm
<input type="button" value="clickme" onclick="document.testFrame.location='test.htm#here';" />
<table>
  <tr valign="top">
    <td><div style="height: 1800px;"></div></td>
    <td><iframe name="testFrame" width="300" height="300" src="test.htm"></iframe>
    </td>
  </tr>
</table>
 
test.htm
<div style="height: 800px;"></div>
<a name="here"></a>
 
Thanks for all the help,
Shrini


Posted By: dpyers
Date Posted: 11 December 2004 at 1:00pm
Stnadard behavior for most browsers is to go to an anchor by re-positioning it as close to the top of the page as possible which also means positioning any container - like an iframe - it's in as close to the top as possible.
 
To get the effect you want, set up each anchor secction as separate pages and use your button onclick event to load a new page in the iframe - it won't reposition the container page.
 
Try something like:
 
top.htm
<input type="button" value="clickme" onclick="document.testFrame.location='testpage2.htm';" />
<table>
  <tr valign="top">
    <td><iframe name="testFrame" width="300" height="300" src="testpage1.htm"></iframe>
    </td>
  </tr>
 
testpage1.htm
<div>Page 1 here</div>
 
testpage2.htm
<div>Page 2 here</div>


-------------

Lead me not into temptation... I know the short cut, follow me.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net