JavaScript代码的编写位置 1.标签内部(不推荐) (1)写在标签的onclick属性中 <button onclik = "alert('你好');"></button> (2)写在a标签的href属性中 <a href="javascript:alert('hello');">嗨<