<html>
<head><title>test</title></head>
<body>
<form>
<input type="submit" name="foo" id="bar" value="Bar" />
<input type="submit" name="baz" id="foo" value="Foo" />
</form>
<span onclick="javascript:alert(document.getElementById('bar').value)">bar (ok)</span>
<span onclick="javascript:alert(document.getElementById('foo').value)">foo (problem on IE 6 & 7)</span>
</body>
</html>