PDA

View Full Version : Link changes select value.



jonnyynnoj
07-26-2007, 07:16 PM
Ive been searching for hours now but not found an answer to this one. What i want to do is when someone clicks a link, it changes the value in the select box.

So far i have come up with:

<script type="javascript">
function changeSelect(x) {
document.getElementById("type").value = x;
}
</script>

<a href="javascript:changeSelect(1)">Link</a>

However that doesn't work. Any help would be appreciated, cheers.

jscheuer1
07-26-2007, 08:02 PM
document.getElementById("type").options.selectedIndex=x;