Hello guys!
I want to write script in JavaScript that will change CSS style with radio buttons. Here is my code:
HTML Code:
<input type="radio" name="style" onclick="changeCSS(1);" />Style 1<br />
<input type="radio" name="style" onclick="changeCSS(2);" />Style 2<br />
Here is my JavaScript code:
Code:
function changeCSS(stylCSS)
{
this.stylCSS = stylCSS;
if (stylCSS == "1") { document.write('<link rel="stylesheet" href="style.css" type="text/css">'); }
if (stylCSS == "2") { document.write('<link rel="stylesheet" href="style2.css" type="text/css">'); }
}
This isn't working... when I click button my page starts to loading forever...
Please help, I'm JS beginner.
Last edited by reQuorter; 10-22-2008 at 09:58 AM..
Reason: resolved
|