码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript - 对象专用语句[ with语句 ]

时间:2014-09-21 23:38:11      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:javascript   王吉平   

<html>

	<head>
		
	<head>

	<body>
		<script language="javascript">
		// 对象专用语句
		// with语句
		/*
		 *	with(对象名称){
		 *		执行语句块
		 *	}
		 */
			var current_time = new Date();
			with(current_time){
				var strDate = getYear() + "年" ;
				strDate += (getMonth() + 1) + "月" ;
				strDate += getDate() + "日" ;
				strDate += getHours() + ":" ;
				strDate += getMinutes() + ":" ;
				strDate += getSeconds() ;
				alert(strDate) ;	
			}			
		</script>
	</body>

</html>

JavaScript - 对象专用语句[ with语句 ]

标签:javascript   王吉平   

原文地址:http://blog.csdn.net/imwangjiping/article/details/39455689

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!