Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

positioning an IFRAME for long web page 1

Status
Not open for further replies.

johnaregan

Programmer
Mar 13, 2001
87
Hi
I have a web page which displays a very long report in a table. My aim to be able to click on a hyperlink on any row to diplay an IFRAME with info on the chosen row (got from another web page).
The IFRAME is initialy hidden until the hyperlink is clicked, then it will be displayed in the centre of the screen.
The problem is that I dont know how to position the IFRAME
so that it always appears in the middle of the web page window no matter where the user has scrolled down to in the long report.

Any help in this would be greatly appriciated.
 
Put the iframe in a DIV. Then position the div with absolute and top= and left= , although I don't recall now how to do it there are some function of javascript to get the screen dimensions, then you divide the values by 2 subtract your iframe width and length and it should center the iframe. I will post the code tommorow for the java stuff.
 
Use these

window.screen.width and window.screen.height

This will give you in pixels the W X D of the screen, subtract the size you want the Iframe to be then divide by 2, this will center it exaclty on the screen, you may want to take into account the task bar etc.

Then use innerHTML and javascript to dynamically create the layer and iframe you iframe code will remain the same.

If you want more let me know. ust reply to this post, I'll watch it for a few days.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top