I am hiding/showing divs using Javascript. I have added php pagenitation to the page and when I browse through the pagenitation, it jumps back to the first div and not the currently viewed div. Any suggestions how to get the Javascript to work inside the php tags?
Herewith the coding:
JAVASCRIPT INSIDE HEADER:
//show div and hide another
function showHide(d)
{
var onediv = document.getElementById(d);
var divs=['content1','content2','content3','content4','content5'];
for (var j=0;ji<divs.length;j++)
{
if (onediv != document.getElementById(divs[j]))
{
document.getElementById(divs[j]).style.display='none';
}
}
onediv.style.display = 'block';
}
NAVIGATION:
<!--navigation menu-->
<div class="menu2">
<a href="javascript:showHide('content1');">1</a>
<a href="javascript:showHide('content2');">2</a>
<a href="javascript:showHide('content3');">3</a>
<a href="javascript:showHide('content5');">5</a>
</div>
<!--end navigation menu-->
THE ACTUAL DIV:
<div class="topcontent" id="content5" style="display:none">
AND PAGINATION PHP:
echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage' 'javascript:showHide('content5');'><</a> ";
</div>
I cannot get the Javascript to work inside the PHP tag
Please help