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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page Within a layer

Status
Not open for further replies.

new2this2002

Programmer
Jun 22, 2002
67
GB
How do i show a page within a layer when a button is pressed for example.

Server supports supports cgi, perl and ssi.

 
are we talking netscape layer or more general layer?

If you mean a Netscape Layer then no Im pretty sure you cannot load a page into a layer tag

If you mean in general then just use an iframe for ie and N6

<iframe src=&quot;about:blank&quot; id=&quot;PageLoader&quot;></iframe>


<input type=button onclick=&quot;LoadPage()&quot;>

<script language=javascript>
//for IE
function LoadPage()
{
PageLoader.location.href=&quot;someFile.htm&quot;
}

//for N6
function LoadPage()
{
document.getElementById(&quot;PageLoader&quot;).location.href=&quot;someFile.htm&quot;
}


its best to combine the two function but test for browser first
 
I read this thread and I have a similiar question.
I have an iframe that I can load other pages into.
Now, in the other pages, i have buttons that
call a javascript function in the parent page.
I tried labeling the function parent.function(name)
but I get an error. Object expected is what is says.
How do I make it so that when I click on a button on the
page inside the iframe, it will send the appropriate
variable to the parent page?
 
subtvshow--

If you are trying to reference a variable or object in the parent window from the iframe, do this:

window.top.elementname

new2this2002--

if you wanted this or a layer, you can do:
<!--either layer or ilayer, I can't remember the tag name!-->
<layer src=&quot;page.html&quot;></layer>

Rick It's a pleasure to know that I've helped you. If I have,
please click the link below to let me know. :)
 
Thanks for your quick response. But im confused.
I tried doing the window.top.elementname, but im not sure
if I put it in the right place, or if I even put the
correct element name. The javascript function
sets up a variable to send an embeded win media player
in the parent page. its referenced as Mediaplayer.
my drop down menus selections look like this:

linkset[0]='<div class=&quot;menuitems&quot;><a href=&quot; target=&quot;ifram&quot;>Catering Halls</a></div>'

this loads the page into my iframe. I would like to
load the page into my parent page somehow because
of all the talk of problems with iframes. I would
probably be able to solve this variable transfer
problem if I could get this page to open without
using the iframe.

The page that has the button to load a video into the media
player has a function that looks like this:

function setBandwidth (connectionSpeed) {
if ((navigator.userAgent.indexOf(&quot;IE&quot;) > -1) && (navigator.platform == &quot;Win32&quot;)) {
MediaPlayer.autoStart = true;
MediaPlayer.Filename = connectionSpeed + '.asx';
} else {
document.MediaPlayer.SetAutoStart(true);
document.MediaPlayer.SetFileName(connectionSpeed + '.asx');
}
}
window.top.MediaPlayer <-this is where i put your solution

the button that calls this function looks like this:

<a href=&quot;#&quot; onClick=&quot;setBandwidth('56vin')&quot;><img width=70 height=37 alt=&quot;Play 56k clip&quot; border=0 src=&quot;part2b.GIF&quot;></a></p>

so how do I get setBandwith info to the parent page?
is there a way I can load the page, because there are
alot of them, into the parent page?
 
Looks like the best solution would be to use php or asp include. I recently converted all my iframes to includes because it works so much better and easier. If you do include instead of iframe, you can call all the functions and variables like they were in the same page, because even though you are including the page, it becomes in with the code for the other included pages.

If you can use php, do this:
<?include(&quot;page.html&quot;);?>

For asp/SSI includes, search the forum for SSI include. It will come up right away.

Rick It's a pleasure to know that I've helped you. If I have,
please click the link below to let me know. :)
 
ok, where do I put the include statement?
in the href line of the pop up memu button?
how do I place the contents of the page where I
want it?
 
Just put the include statement where you want the page to appear (where the iframe is now).

The problem is that you would end up having to make separate pages for each page that used to load in the iframe. If you know anything about switches and case statements, that would be the best way in my opinion. That way you wouldn't have to copy the contents into a bunch of extra pages, you'd just have to make the switch for each page. Am I making any sense?

Rick It's a pleasure to know that I've helped you. If I have,
please click the link below to let me know. :)
 
Im kinda confused. If I put the include statement
in the layer lets say, how do I change it when I
want another page in the layer? I do understand that
I can creat a page and only display certain sections of
it in the layer as they are called by the button, but
i have no idea how to do that. Where do I start?
 
That's what I'm saying. It will be a pain to make all new pages, but you will have to if you use an include. You can't merely change the included file.

I do have a much better idea now that I think about it. Why don't you make a new file for all of your functions? Save it as a javascript file, .js and then you can include it into any page that you want with:
<script src=&quot;filename.js&quot;></script>

It will be much easier.
Rick It's a pleasure to know that I've helped you. If I have,
please click the link below to let me know. :)
 
Thanks for your help! I was able to get it to work
by fixing the javascript function inside the
page of the iframe.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top