How to we reference a Iframe with Page ( server side if possible)

P

Paul

I use ASP and I need to know how to attaches an Iframe Id with its page so I
can load menu options ( eg. 1.htm, 2.htm, 3.htm, ect...) into the Iframe
from any given page on my website.
The problem is for me that I cannot use _top because I am not always on the
page that holds the Iframe in question ( page_iframe.htm ). that holds the
Iframe ( Iframe001). I can load any given page into the iframe only when I
am on ( page_frame.htm.)

Now what if I am on index.asp and I have a menu with sub options. I want
those sub options (eg, 1.htm, 2.htm, 3.htm..ect..) to load into Iframe001
which is located on ( page_frame.htm ) How do we do that?

Here is one idea but its client-side . Is there a better way to do it
server-side?

--------------Client side code----------------------------
- From Menu -
<a href="mainpage.asp?ifp=subpage.asp">Click</a>

mainpage.asp -
<%
ifpsrccode="document.getElementbyid.Iframe001.src='" & request("ifp") & "'"
%>
<html>
....
<body onload="<%=ifpsrccode%>">
<iframe id=Iframe001 name=Iframe001></iframe>
....
</html>
--------------End of client side code----------------------

Thanks in advance for reading this post. :)

Paul
 
K

Kevin Spencer

Hi Paul,

Actually, that is a combination of client-side JavaScript and server-side
HTML. You could certainly avoid the JavaScript part by simply
dynamically-generating the iframe tag with server-side code. Example:

<iframe src="<%=Request.QueryString("ifp")%>"></iframe>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 
P

Paul

HI! Thanks, I think I will try that :)

Paul

Kevin Spencer said:
Hi Paul,

Actually, that is a combination of client-side JavaScript and server-side
HTML. You could certainly avoid the JavaScript part by simply
dynamically-generating the iframe tag with server-side code. Example:

<iframe src="<%=Request.QueryString("ifp")%>"></iframe>

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
The sun never sets on
the Kingdom of Heaven
 
P

Paul

HI! I am a little confused how to use it though?

I can see from the QueryString that it will request the ifp(var) from the
href ( which will be the subpage that the user has choosen).

Now do I put the Query string in place where the Iframe should go and remove
the following.

<%
ifpsrccode="document.getElementbyid.Iframe001.src='" & request("ifp") & "'"
%>
<body onload="<%=ifpsrccode%>">
<iframe id=Iframe001 name=Iframe001></iframe>


Paul
 
P

Paul

Hi! I got it now. thanks :)

Paul
Paul said:
HI! I am a little confused how to use it though?

I can see from the QueryString that it will request the ifp(var) from the
href ( which will be the subpage that the user has choosen).

Now do I put the Query string in place where the Iframe should go and
remove the following.

<%
ifpsrccode="document.getElementbyid.Iframe001.src='" & request("ifp") &
"'"
%>
<body onload="<%=ifpsrccode%>">
<iframe id=Iframe001 name=Iframe001></iframe>


Paul
 
K

Kevin Spencer

Sorry, Paul. I was away during the weekend.

Glad you got it solved!

--

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top