inherit
154242
0
Jul 6, 2011 14:34:53 GMT -8
RyanDiamond
271
May 2010
giantsfan23
|
Post by RyanDiamond on May 30, 2010 11:28:16 GMT -8
Code Name: Custom "Time Based" Welcome Greetings Tested In: Firefox and IE Location: Global Header Support: www.giantscodes.webs.comAnother fun code that you'd like, but be advised: it will not work if you have reworded or removed the welcome table. If you have done that, I may be able to alter it and help you out. It will change "Welcome, GiantsFan23" to any of the three options below depending on what time of day it is on the user's computer. <script type="text/javascript"> /*Custom "Time Based" Welcome Greetings Created By GiantsFan23 - May 2010 For Support - www.giantscodes.webs.com*/
var newString;
var d = new Date(); var time = d.getHours();
if (time < 12) { newString="Good Morning, "; } else if (time>=12 && time<20) { newString="Good Afternoon, "; } else { newString="Good Evening, "; }
var n=document.getElementsByTagName("font")[2]; n.innerHTML=n.innerHTML.replace("Hey, ",newString); </script> How To Change Times: if (time < 12){ newString=" Good Morning, "; Red - Anything below this line and above the next "if" will display if the user's time is before 12. Please note: this uses a 24 hour clock! In the example, the greeting will change to whatever is in the blue if it's before 12 PM. Blue: This is what will be displayed depending on the time. As in the example, if it is before 12 PM, it will say "Good Morning". How To Add More Options: To add more, just copy the following and modify all the times. else if (time>=12 && time<20) { newString="Good Afternoon, "; }
|
|