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

Opening a site from within a template

Status
Not open for further replies.

nero

Programmer
Sep 11, 2000
25
AU
Anyone have any ideas on this one:

I am currently working on a project which involves two websites, one main WebApp and a minor user records site to be viewed from the WebApp.

The WebApp uses a set of templates which consist of header,navbar and footer, with a content area for each page called.

I need to call this site (forms and menus etc.) from within this content area. The trick is there are no frames here, just tables.

Any idea how I might be able to call this site from within the content area of the WebApp site?
 
let me understand this first, the user goes to the page, picks some content, then is sent to the webApp where the selected content is loaded into the page...right? -Greg :-Q

flaga.gif
 
use the <iframe> !


here are the attributes listed in the html 4-0 specs:

<iframe ALIGN=CENTER FRAMEBORDER=0 HEIGHT=&quot;100%&quot; WIDTH=&quot;100%&quot; NAME=&quot;&quot; SCROLLING=YES SRC=&quot;&quot;></iframe>

Robert Carpenter
questions? comments? thanks? email me!
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Thanks for the idea of the iframe.....it works rather well.

What I've now done is taken a form from the original page and called it in a seperate file through iframe.

I'm having a heck of a time trying to reference javascript values and javascript functions in the parent from the child and setting hidden form variables in the child from the parent when theses functions are called.

How do I call from an iframe to that variables and functions in the page calling it?

How do I set hidden form variables in the iframe from the functions which the child called in the parent?

Your help if really appreciated.
 
I guess I am not quite clear, but I think this is what you mean:


from inside the iframe, set the variable foo to 5 and run the bar function (both located in the main window):

parent.foo=5;
parent.bar();

from the main window, set the variable bit to 9 and run the miet function (both located in the iframe):

<iframe name>.bit=9;
<iframe name>.meit();


just be sure to use the name= attribute of the iframe tag Robert Carpenter
questions? comments? thanks? email me!
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Thanks for that.

I'll be playing with this now. I'll let you know.....Cheers.
 
;-)
Robert Carpenter
questions? comments? thanks? email me!
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
hi all, nero and I finished this thread with the email system. for those of you who dont care to read through all our emails, the end problem with the above code was that the iframe needs to be completly loaded before it can be refrenced by the main page. for all those other peoples, here is an email transcript:

Code:
Thanks Robert
 
Your attachments seem not to have come through....but your comment about preemting the iframe loading was spot on.
 
I have solved the issue and greatly appreciate your advice.
 
Cheers
 
Aaron
----- Original Message ----- 
From: Robert Carpenter 
To: Stafford 
Sent: Sunday, November 18, 2001 6:07 PM
Subject: Re: iframe help


Aaron-
 
I created, tested and attached two .html files. one of them is the main window, and the other is the iframe window. save them both to the same directory and open the one named 'tester.html' you should get two alerts.
 
I think your problem might be in the fact that you wern't waiting until the iframe loaded.
 
Hope this helps,
Robert
----- Original Message ----- 
From: Stafford 
To: eclipse_web@hotmail.com 
Sent: Saturday, November 17, 2001 11:23 PM
Subject: iframe help


Robert
 
Thanks for your reply to my post regarding the iframe and passing variables to and from.
 
I have just one question:
 
When you mentioned the parent to iframe relationship, you said simply to for example, <iframe name>.bit>=9;
 
This doesn't seem to work as advertised. Included is a snippet of my code and the error message I am getting when passing variables to the iframe or calling functions from the parent.
 
(By the way you advice on calling parent variables and function with the parent.xxxx worked a treat)
 
login.html
-------------------------------------------------
<SCRIPT language=JavaScript>
<!--
 var foo;              //THIS WORKS
 function bar()  {  //THIS WORKS
 alert(foo);
 }
 anIframe.bit=9;    //ERROR MESSAGE AT THIS POINT
 anIframe.meit();   //NEVER CALLS
//-->
</SCRIPT>
....
<iframe ALIGN=CENTER FRAMEBORDER=0 NAME=&quot;anIframe&quot; SCROLLING=NO SRC=&quot;incLogin.html&quot;></iframe>
....
-------------------------------------------------
 
 
 
incLogin.html
-------------------------------------------------
<SCRIPT language=JavaScript>
<!--
parent.foo=5;     //THIS WORKS
parent.bar();       //THIS WORKS
var bit;
function meit()  { //NEVER GETS CALLED
 alert(bit);
}
//-->
</SCRIPT>
....
-------------------------------------------------
 
 
The error message is:
'anIframe' is undefined
 
 
My ultimate goal hear is to have functions in the parent parsing the url and gathering cookie info and passing these values to hidden form fields in the iframe which will have three forms.
 
Can you clarify how I might actually set a hidden form field value of form within the iframe from the parent?
 
 
Thank you very much for you help so far.
 
I hope you can shed some light on this one.
 
Regards Aaron
Robert Carpenter
questions? comments? thanks? email me!
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top