Hi
I am a complete novice with java, however with the help of this forum and the AUG I have managed to write some java to tell the customer when their order will be delivered. I am however having some trouble with getting the last 2 lines to appear green. When I use span style the var no longer appears.
I'm sure it's simple, please help.
<script language=JavaScript>
now = new Date()
var weekday=new Array(7)
weekday[0]="Sunday"
weekday[1]="Monday"
weekday[2]="Tuesday"
weekday[3]="Wednesday"
weekday[4]="Thursday"
weekday[5]="Friday"
weekday[6]="Saturday"
if ( now.getDay() == 6 ) document.write('<span style="color:green;">order now for delivery Tuesday</span>');
else if ( now.getDay() == 0) document.write('<span style="color:green;">order now for delivery Tuesday</span>');
else if ( now.getHours() >=13 && now.getDay() == 5 ) document.write('<span style="color:green;">order now for delivery Tuesday</span>');
else if ( now.getHours() >=13 && now.getDay() == 4 ) document.write('<span style="color:green;">order now for delivery Monday</span>');
else if ( now.getHours() <13 && now.getDay() == 5 ) document.write('<span style="color:green;">order now for delivery Monday</span>');
else if ( now.getHours() >=13) document.write("Order now for delivery " + weekday[now.getDay()+2]);
else if ( now.getHours() <13) document.write("Order now for delivery " + weekday[now.getDay()+1]);
</script>
Thanks
Steven
I am a complete novice with java, however with the help of this forum and the AUG I have managed to write some java to tell the customer when their order will be delivered. I am however having some trouble with getting the last 2 lines to appear green. When I use span style the var no longer appears.
I'm sure it's simple, please help.
<script language=JavaScript>
now = new Date()
var weekday=new Array(7)
weekday[0]="Sunday"
weekday[1]="Monday"
weekday[2]="Tuesday"
weekday[3]="Wednesday"
weekday[4]="Thursday"
weekday[5]="Friday"
weekday[6]="Saturday"
if ( now.getDay() == 6 ) document.write('<span style="color:green;">order now for delivery Tuesday</span>');
else if ( now.getDay() == 0) document.write('<span style="color:green;">order now for delivery Tuesday</span>');
else if ( now.getHours() >=13 && now.getDay() == 5 ) document.write('<span style="color:green;">order now for delivery Tuesday</span>');
else if ( now.getHours() >=13 && now.getDay() == 4 ) document.write('<span style="color:green;">order now for delivery Monday</span>');
else if ( now.getHours() <13 && now.getDay() == 5 ) document.write('<span style="color:green;">order now for delivery Monday</span>');
else if ( now.getHours() >=13) document.write("Order now for delivery " + weekday[now.getDay()+2]);
else if ( now.getHours() <13) document.write("Order now for delivery " + weekday[now.getDay()+1]);
</script>
Thanks
Steven
Comment