Reply
Iframes and Page Anchor help.
Old 09-13-2006, 02:07 AM Iframes and Page Anchor help.
steve_81's Avatar
Experienced Talker

Posts: 42
I put an Iframe on my site, so that i could save space and i also inserted some page anchors to make it easier to navigate. Now i have a problem. When i click on a question in my FAQ portion of my site, the Page inside the Iframe goes to the question as it should but the page that the Iframe is on also moves down instead of staying at the top of the page. How can i keep this from happening?

The webpage is:

Deranged Productions
steve_81 is offline
Reply With Quote
View Public Profile Visit steve_81's homepage!
 
When You Register, These Ads Go Away!
Old 09-13-2006, 03:48 AM Re: Iframes and Page Anchor help.
Hashim's Avatar
Experienced Talker

Posts: 39
Name: Hashim
Location: Aligarh
Try this iframe script :

HTML Code:
<!-- START OF SCRIPT -->
<script type="text/javascript">

//Specify iframe to display. Change src and other attributes except "position" and "left/top":
var iframetag='<iframe id="masterdiv" src="whatever.htm" width="150px" height="150px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no" style="position: absolute; left: -500px; top: -500px;"></iframe>'

//specify x coordinates of iframe ("right" for right corner, or a pixel number (ie: "20px")):
var masterdivleft="10px"

//specify y coordinates of iframe ("bottom" for bottom of page, or a pixel number (ie: "20px")):
var masterdivtop="bottom"

var ie=(document.all || window.opera) && document.getElementById
var iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body

if (ie)
document.write(iframetag)

function positionit(){
masterdivobj=document.getElementById("masterdiv")
var window_width=ie && !window.opera? iebody.clientWidth : window.innerWidth-20
window_height=ie && !window.opera? iebody.clientHeight : window.innerHeight
var dsocleft=ie? iebody.scrollLeft : pageXOffset
var masterdivwidth=masterdivobj.width
masterdivheight=masterdivobj.height
masterdivobj.style.left=(masterdivleft=="right")? window_width-masterdivwidth-20 : masterdivleft
setInterval("repositionit()", 100)
}

function repositionit(){
if (ie){
dsoctop=ie? iebody.scrollTop : pageYOffset
masterdivobj.style.top=(masterdivtop=="bottom")? window_height-masterdivheight-14+dsoctop : parseInt(masterdivtop)+dsoctop
}
}

if (window.attachEvent)
window.attachEvent("onload", positionit)

</script>
<!-- END OF SCRIPT -->
__________________
http://www.thenetguruz.com <~~~~~ My Blog !

http://www.gadget5.com <~~~~~ Another Blog !
Hashim is offline
Reply With Quote
View Public Profile Visit Hashim's homepage!
 
Old 09-13-2006, 03:23 PM Re: Iframes and Page Anchor help.
steve_81's Avatar
Experienced Talker

Posts: 42
Thanks that solved my problem with that, now how do i get the new iframe centered in the middle of the page? sorry im a noob.
steve_81 is offline
Reply With Quote
View Public Profile Visit steve_81's homepage!
 
Reply     « Reply to Iframes and Page Anchor help.
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11487 seconds with 12 queries