表单验证之在a标签跳转之前执行其他操作(DOM与$两种实现方式)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <a href="https://www.baidu.com/" onclick="return fun1()">揍你</a> <a id="i1" href="https://www.baidu.com/">揍你1</a> <script src="jquery.js"></script> <script> function fun1() { alert(12213) return false } $('#i1').click(function () { alert(88888888888) return false }) </script> </body> </html>