My webpage (www.gagandipsingh.com) is coded mostly on one page, with links calling the following script, which show/hide certain div sections...
<script type="text/javascript">
function show() {
document.getElementById(arguments[0]).style.display='block';
for (var i = 1; i < arguments.length; i++) {
// alert(arguments[i]);
document.getElementById(arguments[i]).style.display='none';
}
return false;
}
</script>
My question is, is it possible to parse the address bar so that a certain div may be shown/hidden? I found i could get variables (ex: gagandipsingh.com?p=code) so I attempted my requirment with the following...
<?php
echo '<script type="text/javascript" src="show_hide.js"></script>';
if (isset($_GET['p']))
{
$page = $_GET['p'];
if ($page == 'code'){
echo "show('Code','Media','Home', 'Resume','Contact')";
}
}
else
{
echo "Variable not set.";
}
?>
which did not work; the function never gets called, just prints that message. You can see an example of that at http://gagandipsingh.com/test/?p=code
Any advice would be greatly appreciated.