javascript - Replace ID to an element for a particular url -
i have 2 list items in navigation:
<body id="trips"> <nav> <li><a href="/trips.php" class="trips">trips</a></li> <li><a href="/trips.php?offer=true" class="offers">offers</a></li> </nav> .... </body>
i need replace on <body id="trips">
<body id="offers">
when visiting /trip.php?offer=true because using css make current page:
#trips.trips, #offers.offers { css "current page" button }
any idea? :)
try this, need add in trips.php
<?php $bodyid = 'trips'; // default value // when `offer` set if(isset($_get['offer']) && trim($_get['offer']) == 'true'){ $bodyid = 'offers'; } ?> <body id="<?php print $bodyid; ?>">
Comments
Post a Comment