Javascript (JS) 抓取目前時間轉換成短網址的假亂數字串

Javascript (JS) 抓取目前時間轉換成短網址的假亂數字串

Javascript (JS) 抓取目前時間轉換成短網址的假亂數字串



實際網址: http://jashliao.eu/yourls/url.html


<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf8">
		 <title>calendar+time</title>
		  <style type="text/css">
			html{font-size:20px;}
			fieldset{width:450px; margin: 0 auto;}
			legend{font-weight:bold; font-size:24px;}
			.label{float:left; width:100px; margin-left:20px;}
			.left{margin-left:180px;font-size:18px;}
			.input{width:500px;}
			span{color: #666666;}
		  </style>	 
		 <style type="text/css">
			 *{margin: 0px;padding: 0px;}
			 .calendar{text-align: center;border-width: thin;}
			 .calendar th{background-color: #6666FF;}
			 .calendar .today{background-color: Orange;color: Red;font-weight: bold;}
		 </style>
		<style type="text/css">
			*{margin: 0px;padding: 0px;}
			.calendar{text-align: center;border-width: thin;}
			.calendar th{background-color: #A9E2F3;}
			.calendar .today{background-color: #00FF00;font-weight: bold;}
			.calendar .weekends{color: Red;font-weight: bold;}
		</style>
	</head>
	<body>
		<script language="JavaScript"> 
			<!--  			
			document.write('<div align="center"><font size="6">'); 
			document.write("<span id='clock'></span>"); 
			document.write("<br/><span id='randstring'></span>");
			var yyyy,now,hours,minutes,seconds,timeValue;
			var x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
			var myArray = [];
			function String2Array(x) {
				for (var i = 0; i < x.length; i++) {
					myArray.push(x.slice(i, i + 1));
				}
			}				
			function showtime(){ 
				now = new Date(); 
				hours = now.getHours(); 
				minutes = now.getMinutes(); 
				seconds = now.getSeconds();
				var yy00 = Math.floor(now.getFullYear()/100);//無條件捨去
				var yy01 = now.getFullYear()%100;
				var MM = (now.getMonth()+1);
				var DD = now.getDate()
				timeValue = now.getFullYear()+"年";
				timeValue += (((now.getMonth()+1) < 10) ? " 0" : " ")+(now.getMonth()+1)+"月";
				timeValue += ((now.getDate()< 10) ? " 0" : " ")+now.getDate()+"日<br>";
				timeValue += (hours >= 12) ? "下午 " : "上午 "; 
				timeValue += ((hours > 12) ? hours - 12 : hours) + " 點"; 
				timeValue += ((minutes < 10) ? " 0" : " ") + minutes + " 分"; 
				timeValue += ((seconds < 10) ? " 0" : " ") + seconds + " 秒"; 
				clock.innerHTML = timeValue;
				String2Array(x);
				var ranstr="對應亂數:"+myArray[yy00]+myArray[yy01]+myArray[MM]+myArray[DD]+myArray[hours]+myArray[minutes]+myArray[seconds];
				randstring.innerHTML = ranstr;
				setTimeout("showtime()",7000); 
			} 		
			showtime();
			document.write('</font></div>');
			//--> 
		</script>
		
	</body>
</html> 


發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *