twinkletoes Posted March 25, 2006 Share Posted March 25, 2006 Hi,I have a problem with my site. I have links on the main page which open up a new sized window when you click on them. USing the code below:A HREF="java script:void(0)"onclick="window.open('newpage.html','linkname','height=400, width=700,scrollbars=yes')"These links open the window up fine, however, if the user doesn't close the window but clicks on the main window then tries another link, the content of the new window changes but it stays in the background. I want it to come to the front of the page so the user can read it!! I think its something to do with focus of the new window.....but i'm not really sure.I would be grateful for any help on this as its driving me crazy!!Thanks...... Link to comment Share on other sites More sharing options...
rongyne Posted March 25, 2006 Share Posted March 25, 2006 Hi,I have a problem with my site. I have links on the main page which open up a new sized window when you click on them. USing the code below:A HREF="java script:void(0)"onclick="window.open('newpage.html','linkname','height=400, width=700,scrollbars=yes')"These links open the window up fine, however, if the user doesn't close the window but clicks on the main window then tries another link, the content of the new window changes but it stays in the background. I want it to come to the front of the page so the user can read it!! I think its something to do with focus of the new window.....but i'm not really sure.I would be grateful for any help on this as its driving me crazy!!Thanks......<{POST_SNAPBACK}> Try this:<script>var windowReference;function go(){windowReference = window.open('newpage.html','linkname','height=400, width=700,scrollbars=yes')}function focus(){windowReference.self.focus()}</script><body><A HREF="java script:go()">Open page</a><A HREF="java script:focus()">Focus page</a></body> Link to comment Share on other sites More sharing options...
twinkletoes Posted March 26, 2006 Author Share Posted March 26, 2006 Thanks for your reply, will try this. Link to comment Share on other sites More sharing options...
martinvie Posted March 28, 2006 Share Posted March 28, 2006 Or this:<script>var windowReference;function go(){windowReference = window.open('newpage.html','linkname','height=400, width=700,scrollbars=yes');windowReference.focus();}</script><body><A HREF="java script:go()">Open page</a></body> Try this:<script>var windowReference;function go(){windowReference = window.open('newpage.html','linkname','height=400, width=700,scrollbars=yes')}function focus(){windowReference.self.focus()}</script><body><A HREF="java script:go()">Open page</a><A HREF="java script:focus()">Focus page</a></body><{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now