[thelist] setAttribute(someevent) in IE?

Kasimir K evolt at kasimir-k.fi
Tue Jun 1 12:29:51 CDT 2004


hi,

would

document.getElementById('thelink').onClick = 'foo()';

do the trick?

.k

sbeam wrote:
> Folks:
> the following code works as expected in Moz but does nothing in Opera 
> and IE. Anyone know how to acheive this?
> ===
> <a id="thelink" href="#">Click Me</a>
> <script type="text/javascript">
>     document.getElementById('thelink').setAttribute('onclick', 'foo()');
> 
>     function foo() {
>         alert('foo');
>     }
> </script>
> ===
> 
> thanks!


More information about the thelist mailing list