Jquery , Current Page Address , Page Name, Tag Searching
Tuesday, October 30, 2012 Category : Jquery 0
<script type="text/javascript">
$(document).ready(function () {
var pathname = window.location.pathname;
var index = pathname.lastIndexOf("/");
var filename = pathname.substr(index + 1);
if (filename == 'Default.aspx' || filename == 'NewSalesUI.aspx' || filename == 'SalesVoid.aspx') {
$('a[href="' + filename + '"]').attr("class", "main current");
}
else {
index = 0;
index = pathname.lastIndexOf("Setup");
if (index > 0) {
var elements = $('span .settings');
if (elements != null && elements != NaN) {
var p = elements.parent().parent();
p.attr("class", "main current");
}
return;
}
index = 0;
index = pathname.lastIndexOf("Operation");
if (index > 0) {
var elements = $('span .operation');
if (elements != null && elements != NaN) {
var p = elements.parent().parent();
p.attr("class", "main current");
}
}
index = 0;
index = pathname.lastIndexOf("Account");
if (index > 0) {
var elements = $('span .newsletter');
if (elements != null && elements != NaN) {
var p = elements.parent().parent();
p.attr("class", "main current");
}
return;
}
index = 0;
index = pathname.lastIndexOf("Report");
if (index > 0) {
var elements = $('span .reports');
if (elements != null && elements != NaN) {
var p = elements.parent().parent();
p.attr("class", "main current");
}
return;
}
}
});
</script>