View Single Post
  #7   Spotlight this post!  
Unread 03-06-2003, 09:08
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
This'll work. You can modify the currentTimestamp() function to fit whatever format you want to use.

script block for the header:

Code:
	<SCRIPT LANGUAGE="Javascript">
	<!--
		// return the current timestamp as a string
		function currentTimestamp()
		{
			var now = new Date();
			var ts = new Array(	
				now.getFullYear().toString(),
				now.getMonth().toString(),
				now.getDay().toString(),
				now.getHours().toString(),
				now.getMinutes().toString(),
				now.getSeconds().toString())
			var i;
			var retval = '';
			
			//pad one-digit values to two and concatenate 			
			//the order is yyyymmddhhnnss
			for (i=0; i<ts.length; i++)
			{
				if (ts[i].length < 2) ts[i] = '0' + ts[i];
				retval += ts[i];
			}
			return (retval);
		}	
	
		//append the current timestamp to a url and redirect
		function sendWithTimestamp(url)
		{
			// check url for a ?
			if (url.indexOf('?') >= 0) url += '&';
			else url += '?';
			
			//build the url
			url += 'time=' + escape(currentTimestamp());
			document.location.href = url;			
		}			
	//-->
	</SCRIPT>
Usage (the bulletin board software injects a space in "JavaScript", so you'll need to change it in the anchor tag):

Code:
<A HREF="javascript:sendWithTimestamp('mypage.php');">MyPage</A>