<form action="http://javascript.ru" method="get">
<a href="#" class="style1">param 1</a><a href="#" class="style2">param 1</a>
<a href="#" class="style1">param 2</a><a href="#" class="style2">param 2</a>
<input type="hidden" name="name[nameid]">
</form>
<script>
window.onload = function () {
document.forms[0].onclick = function (e) {
var inp = this.children[this.children.length - 1];//здесь получаем ссылку на input
e = e || event;
var target = e.target || e.srcElement;
if (target.tagName == 'A') {
if (target == this.children[0] || target == this.children[1]) {
inp.value = 1;
} else {
inp.value = 2;
}
alert(inp.value)
this.submit();
}
}
}
</script>