function nav(name, csskey,cssvalue) {
var url = window.location.pathname + window.location.search;
var v1 = "";
$(name).each(function () {
v1 = "/" + $(this).attr("href");
if (v1 == url) {
var v2 = $(this).css(csskey, cssvalue);
}
})
var url = window.location.pathname + window.location.search;
var v1 = "";
$(name).each(function () {
v1 = "/" + $(this).attr("href");
if (v1 == url) {
var v2 = $(this).css(csskey, cssvalue);
}
})
}
//用法
<script src="Scripts/commo.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function () {
nav(".top ul li a", "background-color", "rgb(255,89,0)");
}
</script>