Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Borrowed Script w/ Flaw...noticed when 'Back'-ing Into OR Refreshing the Page.

    Code was copied from JavaScript Kit:

    http://www.javascriptkit.com/script/...plecombo.shtml

    *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.
    Attached Files Attached Files

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    */
    .....Willy

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,050
    Thanks
    0
    Thanked 251 Times in 247 Posts
    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.

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,050
    Thanks
    0
    Thanked 251 Times in 247 Posts
    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.


    off-topic
    Woo hoo! This is my "formal" 5,000th post!
    Attached Files Attached Files

  • #6
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb How do I do thaat - OPEN a NEW WINDOW

    How would I open a new window to view the target?

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,050
    Thanks
    0
    Thanked 251 Times in 247 Posts
    If you want all items to be opened in a new window regardless of the file type:
    Code:
    function redirect2(z){
       window.open(temp1[z].value, "_blank");
    }
    If you want only pdfs to be opened in a new window:
    Code:
    function redirect2(z){
        if (temp1[z].value.toLowerCase().lastIndexOf('.pdf')!=-1) {
            window.open(temp1[z].value, "_blank");
        }
       else {
            window.location=temp1[z].value;
       }
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •