url截取判断(实现同级列表)
<script> var dUrl=window.location.href; var cUrl=(dUrl.substring(0, dUrl.indexOf('list_'))); var fUrl=(dUrl.substring(0, dUrl.indexOf('index.html'))); var oUrl=document.getElementById("w_lwnav"); var aUrl=oUrl.getElementsByTagName("a"); for(var i=0;i<aUrl.length;i++){ if(aUrl[i].href==dUrl||aUrl[i].href==cUrl||aUrl[i].href==fUrl){ aUrl[i].className="on"; }else{ } } </script>