SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Script Not Working With Chrome

    This works fine in Safari and Firefox but not in Chrome. Can someone tell me why and how to fix it?
    HTML Code:
    <form name="location" id="location">
                                  <select name="menu">
                                    <option selected="selected">Choose One... </option>                                
                                    <option value="../locations/toc-at-fort-sanders-regional/">TOC at Fort Sanders Regional </option>
                                    <option value="../locations/the-tower-at-parkwest/">The Tower at Parkwest </option>
                                    <option value="../locations/oak-ridge-physicians-plaza/">Oak Ridge Physicians Plaza </option>
                                    <option value="../locations/lenoir-city/">Lenoir City </option>
                                    <option value="../locations/randall-robbins-location/">Randall R. Robbins Location </option>
                                    <option value="../locations/seymour/">Seymour </option>
                                    <option value="../locations/toc-spine/">TOC Spine </option>
                                    <option value="../locations/podiatry-oak-ridge/">TOC Podiatry Oak Ridge </option>
                                    <option value="../locations/podiatry-parkwest/">TOC Podiatry Parkwest </option>
                                  </select>
                                  <input type="button" onclick="location=document.location.menu.options[document.location.menu.selectedIndex].value;" value="Go" />
                                </form>
    Todd Temple > T2 Design

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Location
    Bs. As. - Argentina
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Todd Temple View Post
    ...
    <input type="button" onclick="location=document.location.menu.options[document.location.menu.selectedIndex].value;" value="Go" />...
    I do not understand, what is supposed to happen when the user clicks?


    See you

  3. #3
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pablogo View Post
    I do not understand, what is supposed to happen when the user clicks?


    See you
    I guess it is a relocation script? What happens in Chrome?
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  4. #4
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In most other browsers the script redirects them to the page for that select item. In Google Chrome it does nothing at all.
    Todd Temple > T2 Design

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2011
    Location
    Bs. As. - Argentina
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by donboe View Post
    I guess it is a relocation script? What happens in Chrome?
    If this is the case, i gues that <input type="button" onclick="window.location.href=document.location.menu.options[document.location.menu.selectedIndex].value;" value="Go" /> should work everywhere, but i have to say that i would use a function instead of putting JS code on "event", i have hear somewhere that >= IE7 it's disabled by default.

    See you

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    The form name of "location" is being modified instead, so use the full reference of window.location to set the new path.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Guru Todd Temple's Avatar
    Join Date
    Mar 2005
    Location
    Tennessee
    Posts
    797
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    The form name of "location" is being modified instead, so use the full reference of window.location to set the new path.
    You, sir, are a genius! This was perfect. Are there any articles that you could refer me to that discusses this parameter (not sure if parameter is the right word)?
    Todd Temple > T2 Design

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Todd Temple View Post
    You, sir, are a genius! This was perfect. Are there any articles that you could refer me to that discusses this parameter (not sure if parameter is the right word)?
    There is the window.location documentation, if that helps.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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