www.webdeveloper.com
Results 1 to 4 of 4

Thread: Strings?

  1. #1
    Join Date
    May 2008
    Posts
    19

    Strings?

    Not very familiar with Javascript but I have this bit of code for re-directing a page based on drop down menu.

    Code:
            <script>
    			function gotosite() {
    				var URL = document.gotoform.shipTo.options[document.gotoform.shipTo.selectedIndex].value; window.location.href =  URL;
    			} 		
    		</script>
    Works great, except I want to somehow add "?shipTo=" in front of the URL.

    So.. something like?

    Code:
            <script>
    			function gotosite() {
    				var URL = document.gotoform.shipTo.options[document.gotoform.shipTo.selectedIndex].value; window.location.href ='?shipTo='.URL;
    			} 		
    		</script>
    Idk Javascript syntax!

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,354
    Are you sure you want it in the front of the URL?

    Normally it would go at the end.

  3. #3
    Join Date
    Jul 2005
    Location
    USA
    Posts
    912
    Code:
    window.location.href =  '?shipTo='+encodeURIComponent(URL)
    Bitter web veteran

  4. #4
    Join Date
    May 2008
    Posts
    19
    Quote Originally Posted by Webnerd View Post
    Code:
    window.location.href =  '?shipTo='+encodeURIComponent(URL)
    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles