Hello,
I have a menu.jsp included in all the jsps. When I click a link in the menu it calls the respective page and the menu.jsp is also refreshed.
I want to write a java script to highlight the menu link that was clicked. But since the menu jsp is refreshed every time a link is clicked I am not able to show the highlighted link.
Below is the script I am using to highlight the menu link that is clicked

<script type="text/javascript" language="JavaScript">
var lastrowObj="";
function addArrow(rowObj){
if(lastrowObj != ""){
lastrowObj.cells[0].innerHTML = "&nbsp;";
lastrowObj.cells[1].getElementsByTagName('A')[0].className = "greybg";
for(j=0;j<rowObj.cells.length;j++){
lastrowObj.cells[j].className = "greybg";
}
}
rowObj.cells[0].innerHTML = "<img height=7 src='images/rezadminimages/arrow.gif' width=12>";
rowObj.cells[1].getElementsByTagName('A')[0].className = "highlight";

for(i=0;i<rowObj.cells.length;i++){
rowObj.cells.className = "highlight";
}
lastrowObj=rowObj;

}
</script>

Is there any way I can get the value of the link that was clicked even after the page is refreshed.

Recommended Answers

All 2 Replies

Since you're using jsp's it might be easier to store the page that was clicked in the request object and use java programming (not java script) to highlight the page that was selected. The request should keep the page that was selected even after a refresh.

Regards,

Nate

Hello,
I have a menu.jsp included in all the jsps. When I click a link in the menu it calls the respective page and the menu.jsp is also refreshed.
I want to write a java script to highlight the menu link that was clicked. But since the menu jsp is refreshed every time a link is clicked I am not able to show the highlighted link.
Below is the script I am using to highlight the menu link that is clicked

<script type="text/javascript" language="JavaScript">
var lastrowObj="";
function addArrow(rowObj){
if(lastrowObj != ""){
lastrowObj.cells[0].innerHTML = "&nbsp;";
lastrowObj.cells[1].getElementsByTagName('A')[0].className = "greybg";
for(j=0;j<rowObj.cells.length;j++){
lastrowObj.cells[j].className = "greybg";
}
}
rowObj.cells[0].innerHTML = "<img height=7 src='images/rezadminimages/arrow.gif' width=12>";
rowObj.cells[1].getElementsByTagName('A')[0].className = "highlight";

for(i=0;i<rowObj.cells.length;i++){
rowObj.cells.className = "highlight";
}
lastrowObj=rowObj;

}
</script>

Is there any way I can get the value of the link that was clicked even after the page is refreshed.

yes u can get the value of link which is clicked after page is refreshed

by using query string like formName.action="Page to be besubmit value.jsp?p1="+linkvalue ;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.