Click to See Complete Forum and Search --> : Back button with layers
clairetoche
10-04-2004, 06:24 AM
Hi everyone,
I am building a site using Dreamweaver MX using layers and I am having trouble with my navigation system.
I have a page, say page1, which has logos making up a navigation bar. Each logo when selected shows and hides certain layers. On these layers are links to a full version of the page.
When click to the full version, say page2, I can click a button that I named 'back' to return to where I came from.
But my problem is that when clicking the back button, page1 reloads from the beginning, i.e. showing the original layers before the user used the navigation bar.
I would like the user to be able to return to that last stage of the page with the last viewed layers but am not sure if this is possible??
I am fairly ignorant when it comes to programming and stuff so please bear in mind if you answer me!
Thanks,
Claire.
You would need to assign a variable with the currently select layers ID and then have the back button reference this variable.
It really depends on how you have constructed your functions
function show_hide_layer(){
hide layer1 and show layer2
current_layer = layer2
}
function go_back(){
show current_layer
}
Does page2 replace page1?
Is the back button in page2?
If so you would have to amend your function to use the query string
clairetoche
10-04-2004, 08:32 AM
Thanks for your reply.
I understand the idea but am not sure how the functions are built! I have used the show/hide layers function in Dreamweaver and the code is pretty lengthy as I have many layers. Also there are 2 navigations that do the same thing on the same page (page1).
Page1 has the layers and the show/hide functions.
Page2 replaces Page1 and has the back button.
At the moment, I have created several versions of my Page1 so that Page2's back button takes me to a specified version of Page1.
If it helps, it's here: http://www.moonlighting.uk.com/Quiz.html
The link 'more on this event' takes me to Page2 which has the back button on it...
Does this make any sense??
Claire.
JPnyc
10-04-2004, 08:42 AM
Then your back button code must contain something like "history.go(-1) or something. The code that should be called on that back button is the code that calls the previous layer, not that does anything with the parent page at all.
clairetoche
10-04-2004, 08:50 AM
I tried the "history.go(-1)" but that just takes me back to my page with the original layers showing...
Take a look in the attached zip for an example
JPnyc
10-04-2004, 10:56 AM
That's what I'm saying. It SHOULDN'T contain history.go. It should contain only a call to a function that displays the last layer. But that's not going to be so easy for you to write. I never tried writing a function with dreamweaver, but I've seen the confusing convoluted code it spits out.
clairetoche
10-04-2004, 11:47 AM
Thanks Mr J!
It seems to do what I want so I shall try and apply it...
Claire.
Hi Claire.
Dunsel is right about DreamWeaver, it does tend to go overboard with its code.
I have been playing around trying to do you another example so that you can see how much over-coding DreamWeaver does.
See the attached zip file.
You will have to add images to the folder because the zip was too big to upload to this forum with them in.
I have added a list in the zip
clairetoche
10-05-2004, 03:51 AM
Thanks for the file,
It's brilliant and saves me a huge headache!I am having lots of problems with Dreamweaver. As you both said, it seems to add bits of code not needed and when I delete or replace an element on the page, I get all sorts of errors. Is there somewhere on the net where I can learn more about writing code on its own?
Claire.