Firstly, remove javascript: from the onclick attribute. You're confusing this with javascript in the href attribute of a link. In Javascript code, javascript: would create a label named "javascript".
Other than that, foo(event) should work correctly with your final JavaScript code sample. The reason it doesn't work in Firefox but does in Chrome and IE is; they both support the global event object, window.event (which is evaluated when your e.target yields undefined, because this is an element which will not have a target property). Firefox doesn't support the global event object.
Further reading:
Andy E
2010-06-08 21:35:05