Open in same tab or page
Hello. rather than just having a list or categories in my Radio app I'm trying to add a dropdown with a list of Genres (categories).
It works fine but it opens in a new tab. How can I make this open in the same tab or window. Also I would like to have the selection box be to the right of "Choose Station by Genre" instead of below.
Below is my code...
<p>Choose Station by Genre:</p>
<form name="form1">
<select name="genre" id="genre">
<option value="default">Select</option>
<option value="/page/station-category?category=1">60s</option>
<option value="/page/station-category?category=2">70s</option>
<option value="/page/station-category?category=3">80s</option>
<option value="/page/station-category?category=4">90s</option>
<option value="/page/station-category?category=7">Alternative</option>
<option value="/page/station-category?category=11">Blues</option>
<option value="/page/station-category?category=16">Christmas</option>
<option value="/page/station-category?category=18">Classic Rock</option>
<option value="/page/station-category?category=21">Comedy</option>
<option value="/page/station-category?category=24">Country</option>
</select>
<script type="text/javascript">
var urlmenu = document.getElementById( 'genre' );
urlmenu.onchange = function() {
window.open( this.options[ this.selectedIndex ].value );
};
</script>
-
-
·
LeonidS
- ·
Hello @John Curtis !
You may try to change this line in your code:
window.open( this.options[ this.selectedIndex ].value );
to this one:
window.location.assign(this.options[ this.selectedIndex ].value);
-
·
LeonidS
-
Thank you @LeonidS , that worked great.
Would you by chance have a suggestion on how to place the selection box be to the right of "Choose Station by Genre" instead of below?
-
-
·
LeonidS
- ·
The RAW blocm with this code works fine:
<script langauge="javascript">
$(".bx-page-raw-container p").css("float", "left").next().wrap( "<p style='float: left;'></p>" )
</script>
-
·
LeonidS
-
Yes this does do the trick. Thank you.