I have multiple pages with a list of products. Customers can specify the contents using checkboxes. At the end there’s a “reset” button to restore all products back to normal.
The script is called on top of every page using:
[php][/php]
This is the way an option is put on both product pages:
[php]
Kinderactiviteiten (t/m 16)
[/php]
This is the way the reset checkbox is put on both product pages:
[php]
Alles resetten!
[/php]
Now, on the document holdig the script, this is the build-up for every option.
[php]function fadeKinderen(btn) {
document.getElementById(‘checkboxKinder’).style.color = “#454938”; //this changes the text color so the user knows it can’t be used anymore
document.getElementById(‘btnFadeKinderen’).style.visibility = “hidden”; //this hides the checkbox so it can’t be clicked again
document.getElementById(‘btnFadeRESET’).checked = false; //this unchecks the checkbox that is clicked.
$("#divFadeBVG").fadeOut(); //this is a product being removed from the product page
}[/php]
this is the build-up of the reset function:
[php]function fadeRESET(btn) {
//put back all products
$("#divFadeBLO").fadeIn();
//make all checkboxes visible again
document.getElementById('btnFadeKinderen').style.visibility = "visible";
//set all checkboxes checked
document.getElementById('btnFadeKinderen').checked = "checked";
//change the text color back to it's original color.
document.getElementById('checkboxKinder').style.color = "#DAEB98";
}[/php]
On my index page everything works as it should. But I have more pages using this exact same code. On those pages it doesn’t work the way I want it to. It does remove all products, but some text colors don’t restore to its original color, some checkboxes do reappear but unchecked instead of checked. How is this possible? I’ve copied the checkboxes from the index page, the script is called exactly the same way as on the index page.
So basicly, I have multiple pages calling just one external script. Is this the problem? Do I need to change the ID names for the other pages? Because the mark-up can be exactly the same, because the same products are displayed.