赞
踩
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <a href="111fff">1</a> <a href="ssssss">2</a> <a href="fff22">3</a> <script> var aList = document.getElementsByTagName('a'); var rg = /\d+/; for(var i=0;i<aList.length;i++){ (function(i){ aList[i].onclick = function(){ var flag = aList[i].href.match(rg); if(flag) { var truth = window.confirm("该链接存在风险,是否继续点击?"); if(truth){ return true; } else{ return false; } } } })(i) } </script> </body> </html>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。