Drop down menu box
Tampa Brandon Computer Geek

   
   
 

Drop down menu box

by chuck 5/27/2014 7:57:00 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>dropdown bookmarks</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">
window.onload=function() {
// hide list
var objBM=document.getElementById('bookmarks');
objBM.style.display='none';
// create dropdown
var container=document.createElement('div');
var sel=document.createElement('select');
container.appendChild(sel);
objBM.parentNode.insertBefore(container, objBM.nextSibling);
// onchange
sel.onchange=function() {document.location=this.value;};
// fill options
var aBM=objBM.getElementsByTagName('a');
sel.options[0]=new Option('select an option', '');
for(var i=0; i<aBM.length; i++) {
    sel.options[i+1]=new Option(aBM[i].firstChild.data, aBM[i].href);
    }
};
</script>

<style type="text/css">
div[id] {margin:20em 0;}
</style>

</head>
<body>
<ul id="bookmarks">
<li><a href="#one">one</a></li>
<li><a href="#two">two</a></li>
<li><a href="#three">three</a></li>
</ul>
<div id="one">bookmark 1</div>
<div id="two">bookmark 2</div>
<div id="three">bookmark 3</div>
</body>
</html>

Tags:

Related posts

Powered by Brandon Computer Geeks 1.3.1.0
Theme by Contact us


Calendar

<<  October 2017  >>
MoTuWeThFrSaSu
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

View posts in large calendar

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in