Easy Backups with Norton Ghost 10

In this tutorial im going to show how i created the Quick Filter feature on the PlattDeals.com website.

The posts are hidden through a JavaScript function that removes posts that have a certain class applied to them.It sets a css display:none to those posts.

Why display:none over visibility:hidden ?
visibility:hidden would make the post invisible but leave its box in place, display:none will take out the box and move other posts upwards.

Here are the four diffrent Class Names:
free shipping class with rebate – freeshipnorebate
no free shipping class with rebate – nofreeshiprebate
no free shipping with rebate – nofreeshiprebate
free shipping no rebate class – nofreeshipnorebate

Here is how the posts are assigned a class

echo “rebate“;
else
echo “norebate“;
?>”>

Building the checkboxes

Free Shipping

No Mail-In Rebate

these refer to the checkReb() and checkership() functions defined here

function checkership(){
var shipcheck=document.getElementById(’shipcheckbox’).checked;
if (shipcheck==1){dpRemove(’nofreeshipnorebate’);}
else{dpAdd(’nofreeshipnorebate’);}
if (shipcheck==1){dpRemove(’nofreeshiprebate’);}
else{dpAdd(’nofreeshiprebate’);}}

function checkReb(){
var rebcheck=document.getElementById(’rebatecheckbox’).checked;
if (rebcheck==1){dpRemove(’freeshiprebate’);}
else{dpAdd(’freeshiprebate’);}
if (rebcheck==1){dpRemove(’nofreeshiprebate’);}
else{dpAdd(’nofreeshiprebate’);}}

these refer to the dpAdd() and dpRemove() functions defined here.
They set the display to none or block depending on which checkbox is set.

Here is the function that sets the display:none

function dpSemove(theClass){
var allPageTags = new Array();
//Populate the array with all the page tags
var allPageTags=document.getElementsByTagName(”*”);
//Cycle through the tags using a for loop
for (i=0; i<allPageTags.length; i++) {
//Pick out the tags with our class name
if (allPageTags[i].className==theClass) {
//Manipulate this in whatever way you want
allPageTags[i].style.display=’none’;}}}

there is a getElementsById function but none to get them by class, so im using a custom if (allPageTags[i].className==theClass) to locate the posts with the desired class and hide them.

Bug- when the page is refreshed the checkbox stays in its last state.
Fix-

function clearChecks(){
document.getElementById(’rebatecheckbox’).checked=0;
document.getElementById(’shipcheckbox’).checked=0;}
These must be loaded when the page loads