The problem is im trying to set up a different CSS on the different month but it doesnt work
can someone help me out i need help on this
ID:183791
Apr 13 2007, 5:40 pm
|
|
In response to Hiead
|
|
tried that no luck
|
This isn't for your Member blog, is it? Because you can't put Javascript in your Member blog.
|
In response to Crispy
|
|
no its not for my members blog
|
In response to Upinflames
|
|
Bump
and i've retabbed it so it's easier to read i really need help <script type="text/javascript"> var a = new Date() var b = a.getMonth() var e = a.getDate() var f = csss function CSSchoice(csss) { if (b == 1) { if (e == 1) { csss = Febuary.css } else { csss = Origanal.css } else { csss = Origanal.css } } } var g = csss var txt2 = "<link href=\'"+ g +"\' rel=\'stylesheet\' type=\'text/css\'>" document.write(txt2) </script> </body onLoad="CSSchoice()"> |
In response to Upinflames
|
|
Now that you've made the code readable, the problems are actually pretty easy to spot.
1. You've wrapped up everything in a function that is never called, just defined - and even if it was called, your use of scope is all over the place so it wouldn't do anything anyway. You don't need it to be a function. Just kill these lines: function CSSchoice(csss) { And the matching closing brace as well. Also, this line does nothing: var f = csss. Get rid of that too. 2. The names of the files need to be enclosed in double quotes, since they're strings: "February.css", "Original.css" 3. I don't think you need to escape the single quotes like that, since they're in a double-quoted string. |
In response to Crispy
|
|
still no luck should it be under the body tag
|
In response to Upinflames
|
|
It would help if you posted the whole file so I can see what's going on properly.
|
In response to Crispy
|
|
<HTML> |
In response to Upinflames
|
|
You have a closing brace in the wrong place.
Also, you don't need the g var at all. You already have csss, so just use it instead. Fixed version: if (b == 1) |
In response to Crispy
|
|
thx crispy
|
In response to Upinflames
|
|
For future reference, if you view the page in Firefox there's a console that you can open (Tools -> Error console) that displays Javascript errors. That should help in cases like this one.
|
Hiead