HTML - Drop down list with hyper link problum

deepu11111111
@deepu11111111-Vg940z • Oct 26, 2024

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>

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • deepu11111111

    @deepu11111111-Vg940z Jul 17, 2013

    Plzzzz help me guys waiting for u r responce

  • Anoop Kumar

    @anoop-kumar-GDGRCn Jul 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 😀

  • deepu11111111

    @deepu11111111-Vg940z Jul 18, 2013

    I tried the by removing that already but it's not working any tell me how to solve this

  • Anand Tamariya

    @anand-tamariya-DnfjEX Jul 18, 2013

    Use window.location instead of window.open.

  • sookie

    @sookie-T06sFW Aug 1, 2013

    use '_self' instead of '_blank'

  • Manish Goyal

    @manish-r2Hoep Aug 2, 2013

    Replace

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

    With

    onChange="window.location=this.options[this.selectedIndex].value"