I had created a dropdown for some pages in index page, After selecting the a page from dropdown the page will redirect to the respective page. below is the code:
i. Index.html
<script>
function DropList() {
var n = document.getElementById("sel").options.length;
document.getElementById("sel").size = n;
}
function handleSelect(elm){
window.location = elm.value;
}
</script>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<div>
<select id="sel" onchange="javascript:handleSelect(this)">
<option value="page1.html/">page1</option>
<option value="page2.html/">page2</option>
<option value="page3.html/">page3</option>
<option value="page4.html/">page4</option>
</select>
</div>
Now after selecting the page1 from the dropdown the page will redirect to page1.html, where i have given the same drop down code as below:
ii.Page1.html
<div>
<select id="sel" onchange="javascript:handleSelect(this)">
<option value="page1.html/">page1</option>
<option value="page2.html/">page2</option>
<option value="page3.html/">page3</option>
<option value="page4.html/">page4</option>
</select>
</div>
I want to to show the page1 option from the dropdown to be active(default selected in the dropdown) in page1.html page. since it gets redirected after selecting the page1 from the index page.Kindly help me how can i put the page as active.