1. 程式人生 > >點選Input框彈出日期選項

點選Input框彈出日期選項

測試地址:http://down.admin5.com/demo/code_pop/18/1299/

效果圖片:


後臺程式碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>點選text文字框彈出日期選擇器</title>

<!--可無視-->
<style type="text/css">
body{margin:0;padding:0;font:14px Verdana, Arial, sans-serif;line-height:200%;}
#content{padding-left:50px;padding-right:50px;}
#content h2{font-size:18px;color:#1E9300;padding-top:8px;margin-bottom:8px;}
#content h3{margin-top:8px;margin-bottom:8px;FONT:bold 14px 宋體,tahoma,arial,sans-serif;COLOR:#0033CC;}
#content div{margin-top:10px;margin-bottom:10px;border:#666 solid 1px;padding:10px;}
#content span{color:#f00;font-weight:bold;}
ul, ol{color:#000000;}
</style>

<!--必要js檔案/樣式表已經引入在js裡面了-->
<script type="text/javascript" src="lhgcore.js"></script>
<script type="text/javascript" src="lhgcalendar.js"></script>

</head>

<body>

<div id="content">

	<h2>常規彈出日曆示例頁</h2>
	<hr size="1" style="width:400px;" align="left">
	<h3>1. 在控制元件下面或右面彈出日曆元件(預設是在下面彈出) </h3>
	<div>
		<input type="text" id="c1" onclick="J.calendar.get();"/> 顯示在下面    
		<input type="text" id="c2" onclick="J.calendar.get({dir:'right'});"/> 顯示在右面
	</div>
	
	<h3>2. 通過按鈕或圖片等其它控制元件彈出日曆元件</h3>
	<div>
		<input type="text" id="c3"/>
		<input type="button" id="btn" onclick="J.calendar.get({id:'c3'});" value="彈出"/>    
		<input type="text" id="c4"/>
		<img align="absmiddle" src="images/date.gif" onclick="J.calendar.get({id:'c4'});"/>
	</div>
	
	<h3>3. 顯示日期的2種格式(預設為 年-月-日 格式)</h3>
	<div>
		<input type="text" id="c5" onclick="J.calendar.get();"/> 年-月-日 格式    
		<input type="text" id="c6" onclick="J.calendar.get({type:'/'});"/> 月/日/年 格式
	</div>
	
	<h3>4. 在文字框顯示帶時間的日期</h3>
	<div>
		<input type="text" id="c7" onclick="J.calendar.get({time:true});"/>
	</div>
	
	<h3>5. 日期範圍限制</h3>
	<div>
		<input type="text" id="c8" onclick="J.calendar.get({to:'2009-8-8,min'});"/> 只能選擇2009-8-8以前的日期    
		<input type="text" id="c9" onclick="J.calendar.get({to:'2009-8-18,max'});"/> 只能選擇2009-8-18以後的日期<br/>
		<input type="text" id="c10" onclick="J.calendar.get({to:'c11,min'});"/>
		<input type="text" id="c11" onclick="J.calendar.get({to:'c10,max'});"/> 這2個文字框,前面的日期不能大於後面的日期,後面的不能小於前面的日期。
	</div>
	
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>