SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Load stylesheet in Javascript
Threaded View
-
Jul 1, 2008, 09:00 #1
- Join Date
- Jun 2008
- Posts
- 27
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Load stylesheet in Javascript
Hi
I have created a web page with a buttons it.
When user clicks this button (image), I need a new stylesheet to
load.
I put this code in the <head> tag....
<script language="JavaScript">
delCookie('IncreaseSize');
function IncreaseFont()
{
var sTemp = getCookie('IncreaseSize');
var the_length = document.cookie.length;
var iNumber = document.cookie.charAt(the_length-1);
var iCount = Number(iNumber);
var sPage = "style_01.css"
if (sTemp == null)
{
iCount = 1;
setCookie('IncreaseSize', iCount);
alert("Load stylesheet: " + sPage);
}
else if (iCount < 4)
{
iCount = iCount+ 1;
sPage = "style_0" + iCount;
delCookie('IncreaseSize');
setCookie('IncreaseSize', iCount);
alert("Load stylesheet: " + sPage + ".css");
}
else
{
alert ("Can not increase greater than 4");
delCookie('IncreaseSize');
setCookie('IncreaseSize', 4);
}
}
</script>
Bookmarks