George Lucas
12-08-2009, 11:19 PM
I'm trying to make a page where you can change a page's layout through 2 separate CSS's via a button. i want to button to change text when it toggles the layouts as well. i have no clue how to do this with an entire CSS file, but here is something i made to change the background. could i use this logic to change the CSS of a page?
HTML
<in<input type="button" value="change layout" onclick="toggle()" />
JavaScript
var flag = 0; function toggle(){
if(flag==0){
document.getElementById("container").style.backgroundImage="blah.jpg";
flag=1; } else if(flag==1){
document.getElementById("container").style.backgroundImage="blah2.jpg";
flag=0; } }
HTML
<in<input type="button" value="change layout" onclick="toggle()" />
JavaScript
var flag = 0; function toggle(){
if(flag==0){
document.getElementById("container").style.backgroundImage="blah.jpg";
flag=1; } else if(flag==1){
document.getElementById("container").style.backgroundImage="blah2.jpg";
flag=0; } }