js为链接绑定点击事件并且附带return false;来阻止跳转
<!DOCTYPE HTML> <html> <head> <meta charset= "gb2312" /> <title></title> <style> </style> </head> <body> <script> document.getElementById( 'test' ).onclick = function (e){ e = e || window.event; if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false ; } } </script> </body> </html> |