電腦滑鼠細菌數
是馬桶400倍
搬家專業居家清潔
免費到府估價,清潔養護馬上搞定

首頁  •  tw 論壇 • 程式設計討論     • 

[php] PHP 月曆+下拉式清單

房東:小光
發表時間:2011-05-25
[檢舉]


請問我使用以下程式碼


<?

//撰寫日期 2005-11-15

if(isset($_GET[\'Select_Time\'])){

$Show_Time = mktime(0,0,0,date("m",$_GET[\'Select_Time\']),1,date("Y",$_GET[\'Select_Time\']));

}else{

$Show_Time = mktime(0,0,0,date("m",mktime()),1,date("Y",mktime()));

}


$Up_Year_UNIX = $Show_Time - mktime(0,0,0,date("m",$Show_Time),1,date("Y",$Show_Time)-1); //上一年UNIX

$Down_Year_UNIX = mktime(0,0,0,date("m",$Show_Time),1,date("Y",$Show_Time)+1) - $Show_Time; //下一年UNIX

$Up_Month_UNIX = $Show_Time - mktime(0,0,0,date("m",$Show_Time)-1,1,date("Y",$Show_Time)); //上一月UNIX

$Down_Month_UNIX = mktime(0,0,0,date("m",$Show_Time)+1,1,date("Y",$Show_Time)) - $Show_Time; //下一月UNIX

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=big5">

<title>選擇日期</title>

<style type="text/css">

<!--

.style3 {font-size: 12px; color: #5A5A5A; }

a:link {

color: #0000FF;

text-decoration: none;

}

a:visited {

text-decoration: none;

color: #0000FF;

}

a:hover {

text-decoration: none;

color: #FF9900;

}

a:active {

text-decoration: none;

}

.style5 {color: #FF0000}

.style7 {font-size: 12px; color: #FF0000; }

-->

</style>

</head>


<body>


<div align="center">

<form name="form1" method="post" action="">

<table width="200" border="1" cellpadding="3" cellspacing="1" bgcolor="#666666">

<tr align="center" bordercolor="#FFFFFF" bgcolor="#CECECE" class="style3">

<td colspan="7"><table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="50%" align="center"><a href="?target=<?=$_GET[\'target\']?>&Select_Time=<?=($Show_Time - $Up_Year_UNIX )?>">←</a> <span class="style5"><?=date("Y",$Show_Time)?></span> 年 <a href="?target=<?=$_GET[\'target\']?>&Select_Time=<?=($Show_Time + $Down_Year_UNIX )?>">→</a></td>

<td width="50%" align="center"><a href="?target=<?=$_GET[\'target\']?>&Select_Time=<?=($Show_Time - $Up_Month_UNIX )?>">←</a> <span class="style5"><?=date("m",$Show_Time)?></span> 月 <a href="?target=<?=$_GET[\'target\']?>&Select_Time=<?=($Show_Time + $Down_Month_UNIX )?>">→</a></td>

</tr>

</table>

</td>

</tr>

<tr align="center" bordercolor="#FFFFFF" bgcolor="#BEBEBE">

<td><span class="style7">日</span></td>

<td><span class="style3">一</span></td>

<td><span class="style3">二</span></td>

<td><span class="style3">三</span></td>

<td><span class="style3">四</span></td>

<td><span class="style3">五</span></td>

<td><span class="style7">六</span></td>

</tr>

<?

$Day_Count = date("t",$Show_Time); //該月總天數

$Ond_Day = date("w",mktime(0,0,0,date("m",$Show_Time),1,date("Y",$Show_Time))); //該月第一天星期幾

$Rows = ceil(($Day_Count - (7 - $Ond_Day)) / 7) + 1; //星期列數

for($i = 0; $i < $Rows; $i++){

?>

<tr align="center" bordercolor="#FFFFFF" bgcolor="#E8E8E8" class="style3">

<?

for($j = 0; $j < 7; $j++){

if($i == 0){ //第一個星期

if($j >= $Ond_Day){

$Show = "true";

}else{

$Show = "one";

}

}else if($i > 0 && $i < $Rows-1){

$Show = true;

}else if($i == $Rows-1){ //最後一個星期

if($Show_Day < $Day_Count){

$Show = "true";

}else{

$Show = "last";

}

}

/* 改 */$onClick_Str = "window.opener.".$_GET[\'target\'].".value=\'".date("Y-m-d", ( $Show_Time + ( $Show_Day * (60*60*24) ) ) )."\';window.close();";

if($Show == "true"){

$Show_Day++;

?>

<td>

<a href=\'<?=date("Y-n-j", ( $Show_Time + ( ($Show_Day - 1) * (60*60*24) ) ) )?>\' title="<?=date("Y年n月j日", ( $Show_Time + ( ($Show_Day - 1) * (60*60*24) ) ) )?>" onClick="<?=$onClick_Str?>">

<?

if(date("Y") == date("Y",$Show_Time) && date("d") == $Show_Day){

echo "<span class=\'style5\'>".$Show_Day."</span>";

}else{

echo $Show_Day;

}

?></a>

</td>

<?

}else if($Show == "one"){

echo "<td><a title=\'".date("Y年n月j日",$Show_Time - (60*60*24) * ($Ond_Day - $j))."\'>".date("j",$Show_Time - (60*60*24) * ($Ond_Day - $j))."</a></td>";

}else if($Show == "last"){

$last++;

echo "<td><a title=\'".date("Y年n月j日",$Show_Time + (60*60*24) * ($Day_Count + $last - 1))."\'>".date("j",$Show_Time + (60*60*24) * ($Day_Count + $last - 1))."</a></td>";

}

}

?>

</tr>

<?

}

?>

</table>

</form>

</div>

</body>

</html>


然後我想增加一個 下拉式清單 然後add我剛剛點選的年月日,請問該怎麼做呢





  • 贊助網站       

    廣利不動產-板橋在地生根最實在--新板特區指名度最高、值得您信賴的好房仲
    完整房訊,房屋、店面熱門精選物件,廣利不動產 優質仲介,房屋租賃、買賣資訊透明,交易真安心!
    廣利不動產-新板特區指名度最高、值得您信賴的好房仲
    您的托付,廣利用心為您服務



  •  共 0 人回應

    姓名:
    佈告內容: