User a écrit :
Quote:
Is it possible to transform Ordered/Unordered list into navigation dropdown
menus?
A dropdown menu or tag select is used with form to send a variable (name
of select) with choice made (option selected)
How do you expect to get this feature with an ordered/unordered list ?
Probably using css you'll can give appearence of dropdown list to
another kind of list but certainly not selector html behavior.
Quote:
Is this effect achieved by CSS? or via Javascript?
JavaScript with DOM
<script type="text/javascript">
function changeList(listId, selectorName) {
var L2 = document.createElement('SELECT');
L2.name = selectorName;
var L1 = document.getElementById(listId);
var L1o = L1.getElementsByTagName('LI');
for(var i=0; i<L1o.length; i++) {
var o = document.createElement('OPTION');
o.text = o.value = L1o[i].innerHTML;
L2.appendChild(o);
}
document.body.replaceChild(L2, L1);
}
</script>
<ul id="list1">
<li>menu 1</li>
<li>menu 2</li>
<li>menu 3</li>
<li>menu 4</li>
</ul>
<button onclick="changeList('list1', 'choice')">change lists</button>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date