When a page has more than a label, and click will jump to the current page, how to achieve the click of the label color highlighting, other tags back to the primary colors.
Use JS to achieve:
Suppose the current page is "1.aspx"
1. Set the value for a label ID:
<a href= "1.aspx?id=1" id= "1" target= "_parent" > "" </a>
<a href= "1.aspx?id=2" id= "2" target= "_parent ">" </a>
<a href= "1.aspx?id=3" id= "3" target= "_parent" > "</a>
2. Write JS method:
<script>
& (document). Ready (function () {
var id = windows.ulr.substring (windows.ulr.IndeOf ("? id=" ), 1 //Get ID value
var currta = document.getElementById (ID); Gets the currently clicked a tag
if (Currta!= null)
CurrtA.style.color = "#f00";
});
</script>
For other cases, such as clicking on a label page does not jump, you can write this:
<a href= "#" onclick= "Changecss (This)" > "" </a>
<script>
function changecss (obj) {
var alist = document.getElementsByTagName ("a");
for (var i =0;i < alist. length;i++) {
Alist[i].style.color = "#000"; Assign primary colors to all a
tags
obj.style.color = "#f00"; Make the current tab highlight
}
///Of course, you can also use jquery $ ("a"). Removecss () and addcss () to achieve
</script>