Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 06-09-2005, 05:40 PM GetMonth? GetYear?
Average Talker

Posts: 21
Trades: 0
Code:
<html>
<body bgcolor="#000000" text="#C0C0C0" vlink="#C0C0C0" link="#C0C0C0">
<meta http-equiv="refresh" content="3;URL=2005-06june.htm">
<a href="2005-06june.htm">click here</a>.<br><br>
</body></html>
Is there a command to get the current month and year, and then use those values in the html?

I'd like for this autoforwarder to not need to be updated every month.

-Dave in IL
sydcomebak is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-09-2005, 06:27 PM
Average Talker

Posts: 21
Trades: 0
So far so good, now all I need is to somehow make the link the same as the alert. Help?

-Dave in IL

Code:
<html>
<body bgcolor="#000000" text="#C0C0C0" vlink="#C0C0C0" link="#C0C0C0" onload="showDate()";>
<meta http-equiv="refresh" content="10;URL=2005-06june.htm">
<a href="2005-06june.htm">click here</a>.<br><br>
</body>

<script type="text/javascript">
function showDate(){
var d=new Date()
var monthname=new Array(
"january",
"february",
"march",
"april",
"may",
"june",
"july",
"august",
"september",
"october",
"november",
"december")

month = d.getMonth()+1;
if (month <= 9) {month='0'+month}



alert(d.getFullYear() + '-' + month + monthname[month-1] + '.htm');


}
</script>



</html>

Last edited by sydcomebak; 06-09-2005 at 06:30 PM..
sydcomebak is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 07:29 PM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Trades: 0
I think something like this is what you're looking for:
HTML Code:
<html>
<head>
<script>
	function showDate(){
	var d=new Date()
	var monthname=new Array(
	"january",
	"february",
	"march",
	"april",
	"may",
	"june",
	"july",
	"august",
	"september",
	"october",
	"november",
	"december")
	
	month = d.getMonth()+1;
	if (month <= 9) {month='0'+month}
	
	url = d.getFullYear() + '-' + month + monthname[month-1] + '.htm';
	window.location = url;
	}

</script>
</head>
<body bgcolor="#000000" text="#C0C0C0" vlink="#C0C0C0" link="#C0C0C0">
<meta http-equiv="refresh" content="10;URL=2005-06june.htm">
<a href="#" onclick="showDate();">click here</a>.<br><br>
</body>


</html>
__________________

Please login or register to view this content. Registration is FREE
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 06-10-2005, 03:49 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
do be aware that this would get the time and date for the client browser, which may or may not be the same time as the server.

So assuming the page in the target url is auto generated by the server it may not even exist.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to GetMonth? GetYear?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48934 seconds with 12 queries