PDA

View Full Version : iframes w/ referanced html file.... confusing problem



scotty.campbell
01-13-2006, 07:11 AM
so heres one that im not sure is even possible, but im sure one of you guys can figure it out.

i have three iframes inside a table. the bottom frame has my buttons for my page that i want to link to all my different pages, but i want them to load in the center Iframe of the page. here's the trick.

the bottom iframe referances a seperate html file with the buttons in it. that's why im having a problem linking the the button to load the page in the center Iframe......


Does this make since to anyone??? any help would be awesome. Thanks!!!

::sWc::

jscheuer1
01-13-2006, 08:27 AM
Please don't double post . . .

Sounds doable but, I would need to see what you have. Preferably a link to your pages. They don't have to work. Or you could post or attach your code here. If you post code, be sure to do it like so:




code goes here



That way it will look like this:


code goes here

scotty.campbell
01-14-2006, 01:33 AM
yea i tried to figure it out from that other post, but it's a little different.




<html>
<head>
<META HTTP-EQUIV =" imagetoolbar" CONTENT="no">
<title>::sWc::</title>
</head>
<body bgcolor="#f0f0f0" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td>
<div align="center">
<table width="770" border="0" cellspacing="0" cellpadding="0" bgcolor="white" height="540">
<tr>
<td rowspan="3"><IFRAME name=top src=top.htm width=770 height=45 frameborder=0 scrolling=no></iframe>
<IFRAME name=content src=content.htm width=770 height=440 frameborder=0 scrolling=no></iframe>
<IFRAME name=bottom src=bottom.htm width=770 height=110 frameborder=0 scrolling=no></iframe></td>
</tr>

<tr>
</tr>
<tr>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>



so what im trying to do is get the buttons that are in iframe bottom.htm to load the content in the iframe name=content. The thing that's different about this from the other posts is bottom.htm has the buttons in it and it's loaded into the page. The buttons aren't in the frames, so im not sure how to link them up.

thanks for the help guys, im just learning

sWc

scotty.campbell
01-14-2006, 05:31 AM
heres a link to the page so you can see what im trying to do

http://www.swc3d.com/html/

thanks for the help

sWc

jscheuer1
01-14-2006, 10:30 AM
I downloaded your page using FF as a 'Web Page Complete". I then simply added the target attribute to the links on bottom.htm like one would if this were a traditional frames page and it worked fine in IE, FF and Opera. In case you don't know how that is done, it is like so:


<a href="whatever.htm" target="content">Whatever</a>

With a link like that on bottom.htm, when clicked, whatever.htm will be loaded into the central iframe named "content" on the top page.

This is the simplest and best method, as it doesn't rely upon javascript at all. It is straight HTML code and therefore will be accessible to virtually all iframes compliant browsers.

scotty.campbell
01-14-2006, 07:57 PM
awesome! thanks for your help. I dont know why i couldn't get it to work like that before, but thanks for clearing it up for me :)

scott

quaker
01-15-2006, 04:53 AM
Put this before the html tag!

<script type="text/javascript">
/*************************************************************************
This code is from Dynamic Web Coding at http://www.dyn-web.com/
See Terms of Use at http://www.dyn-web.com/bus/terms.html
regarding conditions under which you may use this code.
This notice must be retained in the code as is!
*************************************************************************/

// resize fix for ns4
var origWidth, origHeight;
if (document.layers) {
origWidth = window.innerWidth; origHeight = window.innerHeight;
window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

function loadExternal(url) {
if ( window.frames['ifrm'] ) {
window.frames['ifrm'].location = url;
return false;
} else if ( document.layers ) {
document.layers['outer'].document.layers['inner'].src = url;
return false;
} else return true;
}

</script>

These are the link that i used!
added these to the locations where you want the links showed!

<a class="menulink" href="news.html" onClick="return loadExternal(this.href)">&nbsp;&nbsp;Home</a>
<a class="menulink" href="forum.html" onClick="return loadExternal(this.href)">&nbsp;&nbsp;Forum</a>


Put this in side of the table where you want the iframe to be in!

<iframe id="ifrm" name="ifrm" src="news.html" width="560" height="795" scrolling="yes" frameborder="0"></iframe>



http://nalan.org/new
this is my example of the above iframes.
enjoy!

Twey
01-15-2006, 05:31 AM
John's method
a) is simpler
b) is more compatible
c) was there first.