"Just JavaScript" means without touching CSS? The simplest way seems to be to define the alternate style in CSS and associate it with a class that can be given to the body of the page.
For example, add this rule to your style sheet:
body.contraste {
background: #000000;
}
And a button that runs the code:
var
className = 'contraste',
el = document.querySelector('body');
if (el.classList) {
el.classList.add(className);
}
else {
el.className += ' ' + className;
}
This is the beginning of a way to solve your problem. JavaScript code does not depend on any library framework. It works in current browsers and in IE from 8.
The logic of the solution is that there is a set of rules that style the page in "contrast mode" (whatever it is) and these rules are valid while the body of the page (the body
element) has the contrast class. ..