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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    "custom location bar"

    I'm trying to get a variation of the CUSTOM LOCATION BAR on http://www.sivamdesign.com/scripts/navigate.html (code can be found at http://www.sivamdesign.com/scripts/dwld/location.txt )to work.

    Basically, I want to have users enter a string (e.g., 1234) into a text box, click on the GO button, and then be taken to
    http://domain.com/page.php?1234

    Is that possible, and if so, how is it done?

    Any help is greatly appreciated!

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    this should work
    Code:
    <script>
    function GoToLocation(url){
        location.href='http://' + url;
    }
    </script>
    
    <input type='text' name='url' id='url' /><input type='button' value='Go' onClick='GoToLocation(document.getElementById("url").value);' />

  • Users who have thanked angst for this post:

    rlyesq (01-27-2009)

  • #3
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Worked perfectly. Thanks for the prompt response!

  • #4
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Is there a way to have the script detect the browser, and if it's IE, to have the new page open in a new window?

  • #5
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    try this
    PHP Code:
    <script>
    function 
    GoToLocation(url){
        var 
    browser=navigator.appName;
        if( 
    browser == "Microsoft Internet Explorer" ){
            
    window.open("http://" url,"mywindow","status=1"); 
        } else {
            
    location.href='http://' url;
        }
    }
    </script> 

  • Users who have thanked angst for this post:

    rlyesq (01-27-2009)

  • #6
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks again!


  •  

    Posting Permissions

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