View Full Version : Borrowed Script w/ Flaw...noticed when 'Back'-ing Into OR Refreshing the Page.

J.L. Orozco
06-24-2004, 07:15 PM
Code was copied from JavaScript Kit:


*Note - Attached: Script in a text file (*.txt extension)

Using the script for the first time works perfect.


Once the code is used (directed to a link on the 3rd stage)..and you 'Back Button' into the
page this is displayed [below]...Stage2 and Stage3 are useless..The only way to get the useful
links back is to Select something different in Stage1 to reset everything.


I don't know what's causing this. Refreshing the page doesn't help. It seems the only way
to correct the problem is select something else on Stage 1.

I hope someone can shed some light on this. Please and Thank You.

PS: I'm new to Javascript. All I did was take this code and add array entries.

That's all I know about this script.

Willy Duitt
06-25-2004, 02:59 AM
The first thing you can fixed is returning the credits you removed, but agreed not to when you got the script from Javascript Kit. ;)

Post back with an updated script and I will be glad to take another look.

Triple Combo Script Credit
By Hamid Cheheltani/ JavaScript Kit (http://www.javascriptkit.com)
Visit http://javascriptkit.com for this and over 400+ other scripts


06-25-2004, 04:45 AM
And it's not the script's flaw. You need a way to save the selected item in a "session-based persistent client-side" storage such as window.name property or session cookie and then on the page onload handler, you have to retrieve them and set them as selected.

Willy Duitt
06-25-2004, 02:44 PM
I got your PM and as Glenn suggested, you will need to store the selected item either on the window.name property or a cookie. This exact question has been recently answered. Try searching this forum and/or the Dynamic Drive Scripts Help forum for the already posted solution.

06-29-2004, 03:31 AM
Here's the solution using the "window.name" technique. You can use this if the page this is in is not in a frame or iframe.

I put back the credits to the page, please don't remove it.

Woo hoo! This is my "formal" (http://www.codingforums.com/showthread.php?t=36124&page=4&pp=15#post213558) 5,000th post! :cool:

J.L. Orozco
06-30-2004, 12:36 PM
How would I open a new window to view the target?

06-30-2004, 12:48 PM
If you want all items to be opened in a new window regardless of the file type:

function redirect2(z){
window.open(temp1[z].value, "_blank");

If you want only pdfs to be opened in a new window:

function redirect2(z){
if (temp1[z].value.toLowerCase().lastIndexOf('.pdf')!=-1) {
window.open(temp1[z].value, "_blank");
else {