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?
<!-- 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 -->
__________________
Please login or register to view this content. Registration is FREE <~~~~~ My Blog !
Please login or register to view this content. Registration is FREE <~~~~~ Another Blog !