<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title</title> <style> p { font-size: 400px; } </style> </head> <body> <p>?</p> <a href="javascript:void(0)">点击</a> </body> </html>
上面的代码点击后会回到页面顶部。
解决问题:
76c82f278ac045591c9159d381de2c57 100db36a723c770d327fc0aef2ce13b1 93f0f5c25f18dab9d176bd4f6de5d30e a80eb7cbb6fff8b0ff70bae37074b813 b2386ffb911b14667cb8f0f91ea547a7Title6e916e0f7d1e588d4f442bf645aedb2f c9ccee2e6ea535a969eb3f532ad9fe89 p { font-size: 400px; } 531ac245ce3e4fe3d50054a55f265927 9c3bca370b5104690d9ef395f2c5f8d1 6c04bd5ca3fcae76e30b72ad730ca86d e388a4556c0f65e1904146cc1a846bee?94b3e26ee717c64999d7867364b1b4a3 28005f15af468ab3f7bae64fb648e307点击5db79b134e9f6b82c0b36e0489ee08ed 36cc49f0c466276486e50c850b7e4956 73a6ac4ed44ffec12cee46588e518a5e
好了,问题解决\(^o^)/~
如果想给a标签添加点击事件,可以这样写
76c82f278ac045591c9159d381de2c57 100db36a723c770d327fc0aef2ce13b1 93f0f5c25f18dab9d176bd4f6de5d30e a80eb7cbb6fff8b0ff70bae37074b813 b2386ffb911b14667cb8f0f91ea547a7Title6e916e0f7d1e588d4f442bf645aedb2f c9ccee2e6ea535a969eb3f532ad9fe89 p { font-size: 400px; } 531ac245ce3e4fe3d50054a55f265927 9c3bca370b5104690d9ef395f2c5f8d1 6c04bd5ca3fcae76e30b72ad730ca86d e388a4556c0f65e1904146cc1a846bee?94b3e26ee717c64999d7867364b1b4a3 8684ef87c7ae5da5b0dc8f2aac4e658f点击5db79b134e9f6b82c0b36e0489ee08ed 36cc49f0c466276486e50c850b7e4956 3f1c4e4b6b16bbbd69b2ee476dc4f83a function aClick() { alert("晨落梦公子"); } 2cacc6d41bbb37262a98f745aa00fbf0 73a6ac4ed44ffec12cee46588e518a5e
以上所述是小编给大家介绍的JS中如何实现点击a标签返回页面顶部的问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对PHP中文网的支持!
更多JS中如何实现点击a标签返回页面顶部的问题相关文章请关注PHP中文网!