One guess would be the missing .css
property, another would be the fact that onclick
is not a function, but a result from invoking one:
Make all of .css
a string and assign functions to onclick
:
style1.onclick = function () { swapStyleSheet("default.css") };
style2.onclick = function () { swapStyleSheet("dark.css"); };