Not Solved (Notn a plugin, etc) Need help with switchingskins by time..
#11
Not Solved
As far as I remember, you cannot have multiline strings in Javascript. You have to put everything on one line:
document.write(" <everything here on one line> ");
or separate them in different strings
document.write(" <something> "
+ " <another thing> "
+ " <final thing> ");

Smile
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net
Reply
#12
Not Solved
Okay. Is there any way I can do this with templates too?

EDIT: Is there anything wrong with this script? In it, I assume the clock goes by 1:00 - 24:00 , and not 12:00 AM - 12:00 PM.

<script type="text/javascript">
var ttime= new Date();
var minutes= time.getMinutes()
var seconds= time.getSeconds()
var hours= time.getHours()



if (hours >= 12)
{
document.write('<link rel="stylesheet"
+'type="text/css"'href="http://twinkletowers.freehostia.com/forums/css/theme_7.css" />');
}

if (hours <= 11)
{
document.write('<link rel="stylesheet"
+'type="text/css"'href="http://twinkletowers.freehostia.com/forums/css/theme_7.css" />');
}



</script>
Reply
#13
Not Solved
Last post updated, look above ^^
Bump.............
Reply
#14
Not Solved
Your time variable is spelt wrong plus some other wrong things. Try the code below.

<script type="text/javascript">
var time= new Date();
var minutes= time.getMinutes()
var seconds= time.getSeconds()
var hours= time.getHours()



if (hours >= 12)
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ ' href="http://twinkletowers.freehostia.com/forums/css/theme_7.css" />');
}

if (hours <= 11)
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ ' href="http://twinkletowers.freehostia.com/forums/css/theme_7.css" />');
}

</script>
Reply
#15
Not Solved
Tikitiki Wrote:Your time variable is spelt wrong plus some other wrong things. Try the code below.

<script type="text/javascript">
var time= new Date();
var minutes= time.getMinutes()
var seconds= time.getSeconds()
var hours= time.getHours()



if (hours >= 12)
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ ' href="http://twinkletowers.freehostia.com/forums/css/theme_7.css" />');
}

if (hours <= 11)
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ ' href="http://twinkletowers.freehostia.com/forums/css/theme_7.css" />');
}

</script>

I'm having some trouble. When it is supposed to hit Night (Or, the hours is >= 12) everything goes blank...

Then I tried this:

Quote:<script type="text/javascript">
var time= new Date();
var minutes= time.getMinutes()
var seconds= time.getSeconds()
var hours= time.getHours()



if (hours <= 11)
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ 'href="http://twinkletowers.freehostia.com/forums/css/theme_7.css" />');
}

else
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ 'href="http://twinkletowers.freehostia.com/forums/css/theme_8.css" />');
}

</script>

Still no luck...
Reply
#16
Not Solved
Are you sure theme_8.css is a file? Also you need to add a space in front of href=
Reply
#17
Not Solved
No, it is not a file. I had the same script with a real file (07) however, and it still did not work. Sad
Reply
#18
Not Solved
Okay, I tried it again, and found out the file that was in the script was not what I needed. There is now a working files in it, and only one string per line. But it still will not work.

Here is the script:

<script type="text/javascript">
var time= new Date();
var minutes= time.getMinutes()
var seconds= time.getSeconds()
var hours= time.getHours()



if (hours =< 11)
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ 'href="http://www.fileden.com/files/2007/1/20/671381/theme_16.css"'
+ '/>');
}

else
{
document.write('<link rel="stylesheet"'
+ ' type="text/css"'
+ 'href="http://www.fileden.com/files/2007/1/20/671381/theme_16.css"'
+ '/>');
}

</script>
Reply
#19
Not Solved
*BUMP*

Still doesn't work for some reason... ;~;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)