javascript attaching events

后端 未结 6 1152
有刺的猬
有刺的猬 2020-12-11 07:25

I\'ve seen that you can attach events like this

can you do the same

6条回答
  •  青春惊慌失措
    2020-12-11 08:21

    Something like this:

      document.getElementById('myButton').onclick = function() {location.href='http://stackoverflow.com';return false;}
    

提交回复
热议问题