I have the following code for creating a simple drop down nav. However, this is based on if a value is selected and the GO button will take the user to the link. I would like to put an if/else statement so if no value is selected, GO button will default to 1st link.
<script>
function sendURL(url,obj) {
document.getElementById("urlhidden").value = url;
jQuery('.current').html(obj.parentNode.innerHTML);
}
function submitURL() {
document.location = document.getElementById("urlhidden").value;
}
</script>
<form name="navigate" class="select">
<ul>
<input type="hidden" name="urlhidden" id="urlhidden" />
<li>
<a href="javascript:void(0);" onclick="javascript:sendURL('<?php $link = $GLOBALS['base_url'] . '/node/';echo $link?>4',this)">link1</a>
</li>
<li>
<a href="javascript:void(0);" onclick="javascript:sendURL('<?php $link = $GLOBALS['base_url'] . '/node/';echo $link?>5',this)">link2</a>
</li>
</ul>
<div class="btnHolderInline">
<input type="button" value="Go" onclick="javascript:submitURL();"/>
</div>
</form>