benphp Posted March 23, 2011 Share Posted March 23, 2011 I've been pulling my hair out with this one. I have a page with an iframe with an anchor. Main frame - myTasksIframe.php <iframe src="myTasksIframe.php?PID=1234&testPID=5678#iframeAnchor=$iframeAnchor"> When I click on a link in the iframe: Iframe = myTasksIframe.php <a href="myTask.php?testPID=$testPID&iframeAnchor\" target=\"_parent\">Go to place in iframe</a> it will refresh the main page, and skip down to the anchor in the iframe. Trouble is that the page focus goes to the iframe, and the page is shifted down and I can't figure out how to make the anchor happen while setting the main page to NOT focus on the iframe and shift the page down. I've tried many versions of window.scrollTo(0,0); parent.window.scrollTo(0,0); opener.window.scrollTo(0,0); opener.scrollTo(0,0); parent.window.location = "#" and so on. I can't get any of it to work. Please HELP! Quote Link to comment https://forums.phpfreaks.com/topic/231549-how-to-return-focus-to-parent-page-from-child-page-with-an-anchor/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.