| Body bgcolor napi változtatás, JavaScript |
|
This program has two parts to it. Most of it is just pasted between the <HEAD> tags exactly as it appears in the box below. This sets the code up ready to be called. <script>
/* SM_dailyBgColor() This function automatically changes the page's background color each day of the week. Author: Sean McManus Usage: SM_dailyBgColor ("mondaycolor", "tuesdaycolor", "wednesdaycolor", "thursdaycolor", "fridaycolor", "saturdaycolor", "sundaycolor"); */ function SM_dailybg(sunday,monday,tuesday,wednesday,thursday,friday,saturday) { cols=new Object(); cols[0]=sunday; cols[1]=monday; cols[2]=tuesday; cols[3]=wednesday; cols[4]=thursday; cols[5]=friday; cols[6]=saturday; today=new Date(); day=Math.round(today.getDay()); document.bgColor=cols[day]; document.body.style.background=cols[day]; } </script> To actually change the colour, this command is added to the <BODY> tag: |



