haha... ... ... ... ... ... ... dh cuba ker script yang sebelum ni... ... ... ... ... ... ..php ni sebenarnya x susah... ... easy to learn and understand... ... ... ... kali ni sy akan letakkan script yang paling simple untuk diletakkan di page anda,calendar... hehe... selamat mencuba
1)create main.php
<html>
<head>
<title>kalender</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<form method=post action='' name=f1>
<table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
<td ><font size=2 face='Verdana'>Date lt;/font><input type='text' name='date' size='8'>
<a href="javascript:void(0);"
NAME="KALENDAR"
title="PILIH TARIKH"
onClick=window.open("cal.php","Ratting","width=350,height=270,left=150,top=200,toolbar=1,status=1," ;><img src="calendar.jpg" width="34" height="22" border="0"></a></td>
</tr> </table></form>
</body>
</html>
2)create cal.php
<html>
<head>
<title>KALENDAR</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
<script langauge="javascript">
function post_value(mm,dt,yy){
opener.document.f1.date.value = mm + "/" + dt + "/" + yy;
/// cheange the above line for different date format
self.close();
}
</script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?
if(isset($prm) and $prm > 0){
$m=$prm+$chm;}else{
$m= date("m" ;}
$d= 2; // Finds today's date
$y= date("Y" ; // Finds today's year
$no_of_days = date('t',mktime(0,0,0,$m,$d,$y)); // This is to calculate number of days in a month
$mn=date('M',mktime(0,0,0,$m,$d,$y)); // Month is calculated to display at the top of the calendar
$mn2=date('m',mktime(0,0,0,$m,$d,$y)); // Month is calculated to display at the top of the calendar
$yn=date('Y',mktime(0,0,0,$m,$d,$y)); // Year is calculated to display at the top of the calendar
$yn2=date('y',mktime(0,0,0,$m,$d,$y)); // Year is calculated to display at the top of the calendar
$j= date('w',mktime(0,0,0,$m,1,$y)); // This will calculate the week day of the first day of the month
for($k=1; $k<=$j; $k++){ // Adjustment of date starting
$adj .="<td> </td>";
}
/// Starting of top line showing name of the days of the week
echo " <table border='1' bordercolor='#FFFF00' cellspacing='0' cellpadding='0' align=center>
<tr><td>";
echo "<table cellspacing='0' cellpadding='0' align=center width='100' border='1'><td align=center bgcolor='#ffff00'><font size='3' face='Tahoma'> <a href='cal.php?prm=$m&chm=-1'><</a> </td><td colspan=5 align=center bgcolor='#ffff00'><font size='3' face='Tahoma'>$mn $yn </td><td align=center bgcolor='#ffff00'><font size='3' face='Tahoma'> <a href='cal.php?prm=$m&chm=1'>></a> </td></tr><tr>";
echo "<td><font size='3' face='Tahoma'><b>Sun</b></font></td><td><font size='3' face='Tahoma'><b>Mon</b></font></td><td><font size='3' face='Tahoma'><b>Tue</b></font></td><td><font size='3' face='Tahoma'><b>Wed</b></font></td><td><font size='3' face='Tahoma'><b>Thu</b></font></td><td><font size='3' face='Tahoma'><b>Fri</b></font></td><td><font size='3' face='Tahoma'><b>Sat</b></font></td></tr><tr>";
////// End of the top line showing name of the days of the week//////////
//////// Starting of the days//////////
for($i=1;$i<=$no_of_days;$i++){
$pv="'$mn2'".","."'$i'".","."'$yn2'";
echo $adj."<td valign=top><font size='2' face='Tahoma'><a href='#' onclick=\"post_value($pv);\">$i</a><br>"; // This will display the date inside the calendar cell
echo " </font></td>";
$adj='';
$j ++;
if($j==7){echo "</tr><tr>";
$j=0;}
}
echo "</tr></table></td></tr></table>";
echo "<center><font face='Verdana' size='2'><a href=cal.php>Reset PHP Calendar</a></center></font>";
?>
</body>
</html>
3)carilah mana image dan namakan calendar.jpg
4)kan senang... ..
1)create main.php
<html>
<head>
<title>kalender</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<form method=post action='' name=f1>
<table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
<td ><font size=2 face='Verdana'>Date lt;/font><input type='text' name='date' size='8'>
<a href="javascript:void(0);"
NAME="KALENDAR"
title="PILIH TARIKH"
onClick=window.open("cal.php","Ratting","width=350,height=270,left=150,top=200,toolbar=1,status=1," ;><img src="calendar.jpg" width="34" height="22" border="0"></a></td>
</tr> </table></form>
</body>
</html>
2)create cal.php
<html>
<head>
<title>KALENDAR</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
<script langauge="javascript">
function post_value(mm,dt,yy){
opener.document.f1.date.value = mm + "/" + dt + "/" + yy;
/// cheange the above line for different date format
self.close();
}
</script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?
if(isset($prm) and $prm > 0){
$m=$prm+$chm;}else{
$m= date("m" ;}
$d= 2; // Finds today's date
$y= date("Y" ; // Finds today's year
$no_of_days = date('t',mktime(0,0,0,$m,$d,$y)); // This is to calculate number of days in a month
$mn=date('M',mktime(0,0,0,$m,$d,$y)); // Month is calculated to display at the top of the calendar
$mn2=date('m',mktime(0,0,0,$m,$d,$y)); // Month is calculated to display at the top of the calendar
$yn=date('Y',mktime(0,0,0,$m,$d,$y)); // Year is calculated to display at the top of the calendar
$yn2=date('y',mktime(0,0,0,$m,$d,$y)); // Year is calculated to display at the top of the calendar
$j= date('w',mktime(0,0,0,$m,1,$y)); // This will calculate the week day of the first day of the month
for($k=1; $k<=$j; $k++){ // Adjustment of date starting
$adj .="<td> </td>";
}
/// Starting of top line showing name of the days of the week
echo " <table border='1' bordercolor='#FFFF00' cellspacing='0' cellpadding='0' align=center>
<tr><td>";
echo "<table cellspacing='0' cellpadding='0' align=center width='100' border='1'><td align=center bgcolor='#ffff00'><font size='3' face='Tahoma'> <a href='cal.php?prm=$m&chm=-1'><</a> </td><td colspan=5 align=center bgcolor='#ffff00'><font size='3' face='Tahoma'>$mn $yn </td><td align=center bgcolor='#ffff00'><font size='3' face='Tahoma'> <a href='cal.php?prm=$m&chm=1'>></a> </td></tr><tr>";
echo "<td><font size='3' face='Tahoma'><b>Sun</b></font></td><td><font size='3' face='Tahoma'><b>Mon</b></font></td><td><font size='3' face='Tahoma'><b>Tue</b></font></td><td><font size='3' face='Tahoma'><b>Wed</b></font></td><td><font size='3' face='Tahoma'><b>Thu</b></font></td><td><font size='3' face='Tahoma'><b>Fri</b></font></td><td><font size='3' face='Tahoma'><b>Sat</b></font></td></tr><tr>";
////// End of the top line showing name of the days of the week//////////
//////// Starting of the days//////////
for($i=1;$i<=$no_of_days;$i++){
$pv="'$mn2'".","."'$i'".","."'$yn2'";
echo $adj."<td valign=top><font size='2' face='Tahoma'><a href='#' onclick=\"post_value($pv);\">$i</a><br>"; // This will display the date inside the calendar cell
echo " </font></td>";
$adj='';
$j ++;
if($j==7){echo "</tr><tr>";
$j=0;}
}
echo "</tr></table></td></tr></table>";
echo "<center><font face='Verdana' size='2'><a href=cal.php>Reset PHP Calendar</a></center></font>";
?>
</body>
</html>
3)carilah mana image dan namakan calendar.jpg
4)kan senang... ..
No comments:
Post a Comment