Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-19-2009, 12:30 PM   PM User | #1
MBCUK
New to the CF scene

 
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
MBCUK is an unknown quantity at this point
Date script

Hi,

can anyone help point me in the right direction for a date script which displays tmorrows date unless its saturday in which it displays monday

basically i run a balloon website and we have a panel which tells our customers the next delivery date.


thanks to anyone that can help an amature :-)
MBCUK is offline   Reply With Quote
Old 05-19-2009, 12:53 PM   PM User | #2
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
Code:
function nextDeliveryDate(){
	var d = new Date();
	var offset = d.getDay() != 6 ? 1000*3600*24 : 1000*3600*48;
	d.setTime(d.getTime() + offset);
	return d;
}
alert(nextDeliveryDate().toDateString());
venegal is offline   Reply With Quote
Old 05-19-2009, 01:04 PM   PM User | #3
MBCUK
New to the CF scene

 
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
MBCUK is an unknown quantity at this point
Thanks ever so much,

but just to be a pain... how do insert this into a html page?

Thankyou!
MBCUK is offline   Reply With Quote
Old 05-19-2009, 01:07 PM   PM User | #4
MBCUK
New to the CF scene

 
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
MBCUK is an unknown quantity at this point
ok got it.. just need to change the alert to text :-)
MBCUK is offline   Reply With Quote
Old 05-19-2009, 01:15 PM   PM User | #5
MBCUK
New to the CF scene

 
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
MBCUK is an unknown quantity at this point
Quote:
<script type="text/javascript">

function nextDeliveryDate(){
var d = new Date();
var offset = d.getDay() != 6 ? 1000*3600*24 : 1000*3600*48;
d.setTime(d.getTime() + offset);
return d;
}
alert(nextDeliveryDate().toDateString());

</script>

<input type="text" onLoad="" value="">
Can anyone help put this function into the textbox insead of an alert

Thanks
MBCUK is offline   Reply With Quote
Old 05-19-2009, 01:33 PM   PM User | #6
venegal
Gütkodierer


 
Join Date: Apr 2009
Posts: 2,127
Thanks: 1
Thanked 426 Times in 424 Posts
venegal has a spectacular aura aboutvenegal has a spectacular aura about
Code:
<script type="text/javascript">
function nextDeliveryDate(){
	var d = new Date();
	var offset = d.getDay() != 6 ? 1000*3600*24 : 1000*3600*48;
	d.setTime(d.getTime() + offset);
	return d;
}
window.onload = function(){
	document.getElementById('delivery_date').value = nextDeliveryDate().toDateString();
};
</script>
<input id="delivery_date" type="text" />
venegal is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:20 PM.


Advertisement
Log in to turn off these ads.