CrazyEngineers
  • HTML - Drop down list with hyper link problum

    Updated: Oct 26, 2024
    Views: 1.1K
    Hi guys
    Actually when i was creating a web site , struck with a problem . In the bellow code , i want to direct to a web page when i select an option from the given drop down list . The code is working properly . But the problem is that the required web page is opening in a new tab . What we have to do when we want to do this with in the same tab ( should consider the browser compatibility. ) . The sample code on which i am working is

    <html>
    <head>
     
     
     
    </head>
    <body>
     
    <form >
    <select name="select" onChange="window.open
     
    (this.options[this.selectedIndex].value,'_blank')">
    <option value="https://www.msn.com/ ">MSN</option>
    <option value="https://www.amazon.com/
     
    ">Amazon</option>
    <option value="https://www.google.com/
     
    ">Google</option>
    </select>
    </form>
     
     
    </body>
    </html>
    
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • deepu11111111

    MemberJul 17, 2013

    Plzzzz help me guys waiting for u r responce
    Are you sure? This action cannot be undone.
    Cancel
  • Anoop Kumar

    MemberJul 17, 2013

    Remove this:
    '_blank'
    PS: if you have freedom with your code, try using learning and using jQuery. Your html code will be clutter free more awesome 😀
    Are you sure? This action cannot be undone.
    Cancel
  • deepu11111111

    MemberJul 18, 2013

    I tried the by removing that already but it's not working any tell me how to solve this
    Are you sure? This action cannot be undone.
    Cancel
  • Anand Tamariya

    MemberJul 18, 2013

    Use window.location instead of window.open.
    Are you sure? This action cannot be undone.
    Cancel
  • sookie

    MemberAug 1, 2013

    use '_self' instead of '_blank'
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberAug 2, 2013

    Replace

    onChange="window.open
     
    (this.options[this.selectedIndex].value,'_blank')"
    With

    onChange="window.location=this.options[this.selectedIndex].value"
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register