Solved

Passing URL parameter to a frameset / and all pages in frameset

Posted on 2003-11-02
7
1,822 Views
Last Modified: 2013-11-19
Hey there again guys,

This may sound like a strange question but I was wondering… I have a frameset that has three columns. Each page in these columns is a dynamic ASP pages that pull different information from the database about the same set of information. For example, frame 1 has images of each website I have designed, when clicked frame 2 displays all the images for that site, one at a time in a repeat region. They can scroll through each image and see text for each image in this frame. At the same time when the image in frame 1 is clicked frame 3 loads the selected sites description and general information. You can see what I am trying to do here: http://home.comcast.net/~duncan-e/websites/Portfolio/frameset.html

Now here is the thing. The pages in the frameset will be all dynamic, right down to the header image. What I want to do is pass a URL parameter from the http://home.comcast.net/~duncan-e/websites/Portfolio/index.html page to the frameset.html page, and then have the frameset load all the respective pages with the given URL parameter. Can this be done and if so how?! Any better ideas welcome.

Thanks
0
Comment
Question by:Nugs
  • 4
  • 3
7 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 9667767
One easy way is to use a bit of javascript

<script language=javascript>
function changeframe(source){
parent.framename.location.href="displaypage.asp?url=" & source }
</script>

Then in frame one for each picture surround with an hyperlink
<a href="javascript:changeframe('<%=source%>')" STYLE='text-decoration: none'>
<img src="">
</a>
Just pass the site variable into the href tag as 'source', I'm assuming the filename is the same but you just pass in a variable to tell it which site to display.
The same methodology applies to frame 2 to change frame 3's source.


Also please maintain your old open questions, some go back quite some time.
0
 
LVL 2

Author Comment

by:Nugs
ID: 9669133
No, maybe I didn't explain the question well enough but i don't think that helps me.

From the main page (index.asp) I am passing two URL parameters. I.e. when the user clicks on Web Design the link reads something like this: portfolio.asp?projCode=ias&sectCode=web. Each project I have done has a id, projCode is the field that holds this. sectCode is the category or section the project is in like Web or Print, etc… Portfolio.asp is the frameset page and looks like this:

<%@LANGUAGE="VBSCRIPT"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<frameset rows="*" cols="560,*" framespacing="0" frameborder="NO" border="0">
  <frameset cols="189,*" frameborder="NO" border="0" framespacing="0">
    <frame src="left.asp?SectCode=web" name="leftFrame" scrolling="NO" noresize>
    <frameset rows="130,*" frameborder="NO" border="0" framespacing="0">
            <frame src="header.asp?SectCode=web" name="topFrame" scrolling="NO" noresize>
            <frame src="main.asp?projCode=ias" name="mainFrame" scrolling="auto" noresize>
      </frameset>
  </frameset>
  <frameset rows="61,*" frameborder="NO" border="0" framespacing="0">
            <frame src="searchpanel.asp" name="topFrame1" scrolling="NO" noresize>
            <frame src="right.asp?projCode=ias" name="rightFrame" scrolling="auto" noresize>
  </frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>

As you notice I have put the URL parameter for each frame in there manually. What I need this frameset page to do is pull the URL parameters that the index page passes and place them where I have placed the above URL parameters… Make sense?

Nugs

PS: my other questions questions have not been answered
0
 
LVL 58

Expert Comment

by:Gary
ID: 9669237
I don't see the problem, my solution does exactly what you want.  Your main page that sets the frames above is fine as it is.  
Frame one loads as a default since all its doing is displaying the webs and so the data there is static and doesn't change - correct?  So you loop through the images that are displayed for each web site and set the href tag to main.asp and dynamically put in the appropriate variables to pass to frame 2 e.g.
<a href="javascript:changeframe('<%=rs("ias")%>','<%=rs("web")%>)" STYLE='text-decoration: none'>
<img src="">
</a>
Along with the javascript
<script language=javascript>
function changeframe(ias,web){
parent.framename.location.href="portfolio.asp?ias=" + ias +"&sectcode=" + web}
</script>
So on the onclick event of the href tag of the web images the javascript function gets called and changes the location of frame 2 to portfolio.asp and also passes the two variables to it.  So in the page that is loaded in frame 2 you just call these two variables and build the page accordingly.  

Heres a simple example,  if this totally off then sorry I don't understand what you mean at all
http://www.intouchmedialtd.com/frame/frame.html
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 2

Author Comment

by:Nugs
ID: 9669544
I can easily controll the other frames from the webs frame on the left. What i am trying to do is initialy set each frames pages with the URL parameter that corosponds to the section they selected (Web Design, Print, etc...) Essentialy i need the frameset to be dynamic and pass the url parameters to each page in the frameset accordingly.

Could you explain the javascript above, maybe this is the solution and i am not understanding.

Nugs
0
 
LVL 2

Author Comment

by:Nugs
ID: 9669570
All i bassicly need is to figure out how i basicly get the frameset page to check the current URL, see what the value for sectCode and projCode are and then set  the Left and Top frame with the sectCode parameter and the Main and Right frames to load there pages with the projCode URL parameter. Thats all...
0
 
LVL 58

Accepted Solution

by:
Gary earned 50 total points
ID: 9671873
Ok so from the querystring we get
<%
sectCode=request("sectCode")
projCode=request("projCode")
%>
Then your frame line becomes
<frame src="left.asp?SectCode=<%=sectCode%>" name="leftFrame" scrolling="NO" noresize>
Same applies for all frame sources.
0
 
LVL 2

Author Comment

by:Nugs
ID: 9673938
I actualy got it working last night. i simply added two recordsets to the frameset and that seems to do the url parameter filtering fine. code looks something like this now:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/portfolioConn.asp" -->
<%
Dim LeftCont__MMColParam
LeftCont__MMColParam = "1"
If (Request.QueryString("SectCode") <> "") Then
  LeftCont__MMColParam = Request.QueryString("SectCode")
End If
%>
<%
Dim LeftCont
Dim LeftCont_numRows

Set LeftCont = Server.CreateObject("ADODB.Recordset")
LeftCont.ActiveConnection = MM_portfolioConn_STRING
LeftCont.Source = "SELECT * FROM SectionSlides WHERE SectCode = '" + Replace(LeftCont__MMColParam, "'", "''") + "'"
LeftCont.CursorType = 0
LeftCont.CursorLocation = 2
LeftCont.LockType = 1
LeftCont.Open()

LeftCont_numRows = 0
%>
<%
Dim Header__MMColParam
Header__MMColParam = "1"
If (Request.QueryString("SectCode") <> "") Then
  Header__MMColParam = Request.QueryString("SectCode")
End If
%>
<%
Dim Header
Dim Header_numRows

Set Header = Server.CreateObject("ADODB.Recordset")
Header.ActiveConnection = MM_portfolioConn_STRING
Header.Source = "SELECT * FROM SectionHeader WHERE SectCode = '" + Replace(Header__MMColParam, "'", "''") + "'"
Header.CursorType = 0
Header.CursorLocation = 2
Header.LockType = 1
Header.Open()

Header_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<frameset rows="*" cols="560,*" framespacing="0" frameborder="NO" border="0">
  <frameset cols="189,*" frameborder="NO" border="0" framespacing="0">
    <frame src="left.asp?sectCode=<%=(LeftCont.Fields.Item("SectCode").Value)%>" name="leftFrame" scrolling="NO" noresize>
    <frameset rows="130,*" frameborder="NO" border="0" framespacing="0">
            <frame src="header.asp?sectCode=<%=(Header.Fields.Item("SectCode").Value)%>" name="topFrame" scrolling="NO" noresize>
            <frame src="blank.asp" name="mainFrame" scrolling="auto" noresize>
      </frameset>
  </frameset>
  <frameset rows="61,*" frameborder="NO" border="0" framespacing="0">
            <frame src="searchpanel.asp" name="topFrame1" scrolling="NO" noresize>
            <frame src="blank.asp" name="rightFrame" scrolling="auto" noresize>
  </frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>
<%
LeftCont.Close()
Set LeftCont = Nothing
%>
<%
Header.Close()
Set Header = Nothing
%>


Thanks for your advice,
Nugs
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now