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

Frames and Menu History

Status
Not open for further replies.

Snaggs

Programmer
Jan 11, 2000
393
US
I have a web page setup using frames just like this one:
TTTTTTTTTTTTT
TTTTTTTTTTTTT
MMMDDDDDDDDDD
MMMDDDDDDDDDD
MMMDDDDDDDDDD
MMMDDDDDDDDDD
MMMDDDDDDDDDD
MMMDDDDDDDDDD

T=Title frame
M=Menu frame
D=Detail frame

Down the left side I have the menu options the user can pick from. However, when they pick an option, I reload a new menu in the left frame to give them the new options. When a menu option has a sub menu to it, the sub menu is loaded in the menu frame. When the last option is selected in the menu, the detail section is filled in. I'm not using a treeview on the site, but I'll use one here to as an example of the levels in the menu.

For example:

Admin (root menu item)
+------Edit Customers
+------Edit Items

When they click on Admin, Edit Customers and Edit Items would show up in the menu section.

What I'd really like to do is create a menu history or menu chain in the TITLE frame above the menu. It would start off saying "Home". When they click on Admin, I want it to say

Home >> Admin

in the TITLE w/ hyperlinks so they can get back to any part in the menu chain quickly. Finally when they click on Edit Customers it would say:

Home >> Admin >> Edit Customers

again, in the title frame.

First of all I don't know what the name of this functinality is called. You may have seen it on eBay before when you start drilling down into categories it starts building a menu history or menu chain of where you came from and the chain is hyperlinked to take you back.

Does anyone have any sample code to do this or can you recommend a good site to check for how to do this?

Thanks, Snaggs
tribesaddict@swbell.net
Life can only be understood backwards; but it must be lived forwards.
 
How are you creating the menu pages, are they static or dynamic? Derren
[Mediocre talent - spread really thin]
 
The menus are static. I'm a newbie to ASP and I'm on a tight time schedule. When you click a menu option, it just loads a new page.

Thanks for the response, hope this gives you more assistance in assisting me.

Thanks, Snaggs
tribesaddict@swbell.net
Life can only be understood backwards; but it must be lived forwards.
 
If all of your menu pages are static then simply write the links at the top as you are in so much of a hurry. Then when you have some more time you can send querystrings to the menu page to decide which menu to look at. Then you can check these values at the top of the menu to show the hierarchy. Derren
[Mediocre talent - spread really thin]
 
Derren,

Thanks for the information and that'll work out just fine for now. However can you tell me how to update a page in a different frame? I am already using the "target" line and the name of the frame where needed.

Remember, I want the Menu chain to show up in the TITLE frame. It should be updated when the MENU frame is changed. The reason I ask the question is I am already updating the menu or the detail frame, but now it seems like I need to update 2 frames at the same time, and I'm not sure how to do this. If you can point me in the right direction I can make it work.

Here's an example of how I load the detail from the menu. I'm not sure how I would make it also load a new page in the Title frame at the same time.

-----<Admin Menu>---------
<html>
<head>
<title>Administration Menu</title>
</head>
<body>

<a href=&quot;editcustomer.asp&quot; target=&quot;detail&quot;>Customers</a><br>
<a href=&quot;edititem.asp&quot; target=&quot;detail&quot;>Items</a><br>
<a href=&quot;editemployee.asp&quot; target=&quot;detail&quot;>Employees</a><br>

</body>
</html>
-----<Admin Menu>---------

Here's a different way that I update the menu when I have to pass a variable to the next menu down the list. This somehow needs to also tell a page to load in the TITLE at the same time or just after the new sub menu is loaded.

-----------<Customer Menu>---------
<%@ Language=VBScript %>
<HTML>
<HEAD>
<title>Customers</title>
<SCRIPT Language=&quot;VBScript&quot;>
Function FormSubmit(CustomerID)
document.customer.CustomerID.value = CustomerID
document.customer.submit
End Function
</SCRIPT>
</HEAD>
<BODY>
<FORM name=&quot;customer&quot; id=&quot;go&quot; action=&quot;farm.asp&quot; method=&quot;post&quot;>
<%
Dim deCustomer

Set deCustomer = server.CreateObject(&quot;DERuntime.DERuntime&quot;)
deCustomer.Init(Application(&quot;DE&quot;))
deCustomer.Customer
%>

<INPUT type=&quot;hidden&quot; name=&quot;CustomerID&quot; value=&quot;&quot;>

<%
Do Until deCustomer.Recordsets(&quot;Customer&quot;).EOF %>
<A href=&quot;#&quot; onclick=&quot;FormSubmit('<%=deCustomer.Recordsets(&quot;Customer&quot;).Fields(&quot;CustomerID&quot;).Value%>')&quot;>
<%=deCustomer.Recordsets(&quot;Customer&quot;).Fields(&quot;CustomerName&quot;).Value %> </A><BR>
<%deCustomer.Recordsets(&quot;Customer&quot;).MoveNext
Loop

deCustomer.Recordsets(&quot;Customer&quot;).Close
Set deCustomer = Nothing
%>
</FORM>
</BODY>
</HTML>
-----------<Customer Menu>---------

Thanks again,
Snaggs
tribesaddict@swbell.net
Life can only be understood backwards; but it must be lived forwards.
 
The solution to this is a javascript one. (Its best not to use VBscript clientside.) Use the onload event to modify the title frame:

<script language=javascript>
function changeTitleFrame(){
//code to affect the title frame goes here, see below
}

onload=changeTitleFrame;
</script>

Now this can go 2 ways, you can either:

1. Simply reload a different page into the top frame with the relevant link history on it by using the above function. Easy to do but lots of pages and reloading.

2. Or (if you dont mind this not working in Netscape) you could dynamically modify the links in the top frame from the above function using innerHTML. Slightly more javascript but no reloading of pages needs to be done for the top frame.

We'll stick with option 1 for now. Put the following code within the changeTitleFrame() function:

parent.frames[&quot;banner&quot;].document.replace(&quot;banner2.htm&quot;);

As you are loading a different page into the menu frame each time then each of those pages will need to have a different link (&quot;banner2.htm&quot;) for the correct title page to load in.

Hope that helps

ASCII silly question, get a silly ANSI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top