请问下面的语句怎么通过替换?如果是正则,该怎么写?大概有500行左右。

 <a href="http://qhd.tuniu.com" onclick="_gaq.push(['_trackEvent', '首页_wh','点击','选预定城市_华北_秦皇岛']);">秦皇岛</a>
                       <a href="http://wf.tuniu.com" onclick="_gaq.push(['_trackEvent', '首页_wh','点击','选预定城市_华北_潍坊']);">潍坊</a>
                       <a href="http://zjk.tuniu.com" onclick="_gaq.push(['_trackEvent', '首页_wh','点击','选预定城市_华北_张家口']);">张家口</a>
                       <a href="http://chzh.tuniu.com" onclick="_gaq.push(['_trackEvent', '首页_wh','点击','选预定城市_华北_长治']);">长治</a>

全部替换成

<a href="#">这里不变</a>


迁就LOSE
浏览 1988回答 2
2回答

jerame

<script>var a=document.getElementsByTagName('a'); window.onload=function(){ for (var i=0; i<a.length; i++) { a[i].setAttribute("href","#"); a[i].removeAttribute("onclick"); } }</script>用HTML DOM实现
打开App,查看更多内容
随时随地看视频慕课网APP