property to access within a function

HTML

<button type="button" id="1" onclick="assignAllClick(this)" value="2" foo="test">Test</button>

<script>function assignAllClick(button) {
                                document.write('This is "foo": ' + button.foo + '<br>and this is "ID": ' + button.id);
                                }</script>