|
|
|
พี่ๆๆคับ จะต้องทำยังงัยคับ ที่จะให้ค่า มัน alert ออกมา ดังรูปคับ |
|
|
|
|
|
|
|
รูปตัวอย่างคับ ต้องให้พอกดปุ่มแล้ว alert มาแสดง คับ ค่าที่ mark สีดำ ไว้อ่าคับ ต้องทำยยังคับ
Code (PHP)
<?
function ChkDay($myDay){
$x = 0;
if ($myDay == "Sunday"){
$x = 1;
}else if ($myDay == "Monday"){
$x = 2;
}else if ($myDay == "Tuesday"){
$x = 3;
}else if ($myDay == "Wednesday"){
$x = 4;
}else if ($myDay == "Thursday"){
$x = 5;
}else if ($myDay == "Friday"){
$x = 6;
}else if ($myDay == "Saturday"){
$x = 7;
}
return $x;
}
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script type="text/javascript" charset="utf-8">
function Chk1(x){
if (document.form1.Vac_VacationID1[x - 1].checked == true){
document.form1.Vac_VacationID2[x - 1].disabled = true;
document.form1.Vac_VacationID3[x - 1].disabled = true;
}else{
document.form1.Vac_VacationID2[x - 1].disabled = false;
document.form1.Vac_VacationID3[x - 1].disabled = false;
}
}
function Chk2(x){
if (document.form1.Vac_VacationID2[x - 1].checked == true){
document.form1.Vac_VacationID1[x - 1].disabled = true;
document.form1.Vac_VacationID3[x - 1].disabled = true;
}else{
document.form1.Vac_VacationID1[x - 1].disabled = false;
document.form1.Vac_VacationID3[x - 1].disabled = false;
}
}
function Chk3(x){
if (document.form1.Vac_VacationID3[x - 1].checked == true){
document.form1.Vac_VacationID2[x - 1].disabled = true;
document.form1.Vac_VacationID1[x - 1].disabled = true;
}else{
document.form1.Vac_VacationID2[x - 1].disabled = false;
document.form1.Vac_VacationID1[x - 1].disabled = false;
}
}
function mySave1(x,month1,yaer1,Vacation){
for (i=0;i<=x - 1;i++){
if (document.form1.Vac_VacationID1[i].checked){
//window.location ="savecalendar.php?ID=Vac_VacationID1&$mydate=" + (i+1) + "/" + month1 + "/" + yaer1;//บันทึก
alert("savecalendar.php?Vac_VacationID1&myDate=" + (i+1) + "/" + month1 + "/" + yaer1 + "/" + Vacation);
}
if (document.form1.Vac_VacationID2[i].checked){
alert("savecalendar.php?Vac_VacationID1&myDate=" + (i+1) + "/" + month1 + "/" + yaer1 + "/" + Vacation);
}
if (document.form1.Vac_VacationID3[i].checked){
alert("savecalendar.php?Vac_VacationID1&myDate=" + (i+1) + "/" + month1 + "/" + yaer1 + "/" + Vacation);
}
}
}
</script>
</head>
<body>
<input type="checkbox" name="xx1" id="xx1">
<label for="xx1">xx1</label>
<?php
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set('UTC');
// Prints something like: Monday
echo date("l");
// Prints something like: Monday 8th of August 2005 03:12:46 PM
?><br /><?
echo date('l jS \of F Y h:i:s A');;;
?><br /><?
// Prints: July 1, 2000 is on a Saturday
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
?><br /><?
/* use the constants in the format parameter */
// prints something like: Mon, 15 Aug 2005 15:12:46 UTC
echo date(DATE_RFC822);
?><br /><?
// prints something like: 2000-07-01T00:00:00+00:00
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
<br />
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 1, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 2, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 3, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 4, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 5, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 6, 2013)); ?>
<br /><? echo "xx = " . date("l", mktime(0, 0, 0, 7, 7, 2013)); ?>
<br />
<?php
$info = cal_days_in_month( CAL_GREGORIAN , 1 , 2013 ) ;
echo $info ;
?>
<?
$info = cal_days_in_month( CAL_GREGORIAN , 1, 2013 ) ;
$myDate = 1;
$x1 = 1;
$x = ChkDay(date("l", mktime(0, 0, 0, 1, 1, 2013)));
echo "x = " . $x;
echo " month = " . date("m");
?>
<form name="form1" method="post" action="savecalendar.php">
<table border="1" cellspacing="1" width="90%" align="center">
<tr align="center">
<td width="15%" height="50px" bgcolor="red">อาทิตย์</td>
<td width="14%" bgcolor="gray">จันทร์</td>
<td width="14%" bgcolor="gray">อังคาร</td>
<td width="14%" bgcolor="gray">พุธ</td>
<td width="14%" bgcolor="gray">พฤหัสบดี</td>
<td width="14%" bgcolor="gray">ศุกร์</td>
<td bgcolor="red">เสาร์</td>
</tr>
<? $x1 = $x1 - $x + 1;
for($j=0;$j<7;$j++){ ?>
<tr>
<? for($i=1;$i<=7;$i++){ ?>
<td align="center" height="100px" valign="top">
<? if ($x1>0&&$x1<=$info){ ?>
<table width="100%" align="center" border="0" cellspacing="0">
<tr align="center">
<td colspan="2" height="50px"><? echo $x1; ?></td>
</tr>
<tr align="center">
<td colspan="2">
<input type="checkbox" name="Vac_VacationID1" id="Vac_VacationID1"
value="เต็มวัน" onClick="Chk1(<? echo $x1; ?>);" />เต็มวัน</td>
</tr>
<tr align="center">
<td>
<input type="checkbox" name="Vac_VacationID2" id="Vac_VacationID2"
value="เช้า" onClick="Chk2(<? echo $x1; ?>);" />เช้า</td>
<td>
<input name="Vac_VacationID3" type="checkbox" id="Vac_VacationID3" onClick="Chk3(<? echo $x1; ?>);"
value="บ่าย" />บ่าย</td>
</tr>
</table>
<? } $x1++; ?></td>
<?}?>
</tr>
<?
if($x1>$info){
$j = 7;
}}?>
<tr align="center">
<td colspan="7"><label>
</label>
<input type="button" name="Submit1" value="บันทึก" id="Submit1" onClick="mySave1('<? echo $info ?>',
'<? echo date("m"); ?>','<? echo date("Y"); ?>','<? echo ("x") ?>')"title="บันทึกข้อมูลใหม่"></td>
</tr>
<tr align="center">
<td colspan="7"> </td>
</tr>
</table>
</form>
<? echo "day of month = " . $info; ?>
</body>
</html>
Tag : PHP, JavaScript
|
|
|
|
|
|
Date :
2013-01-17 09:42:28 |
By :
pongtave |
View :
805 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองเอาไปใส่ใน function ดูน่ะครับ
Code (PHP)
function Chk1(x){
if (document.form1.Vac_VacationID1[x - 1].checked == true){
document.form1.Vac_VacationID2[x - 1].disabled = true;
document.form1.Vac_VacationID3[x - 1].disabled = true;
}else{
document.form1.Vac_VacationID2[x - 1].disabled = false;
document.form1.Vac_VacationID3[x - 1].disabled = false;
}
alert('Vac_VacationID1 ');
}
|
|
|
|
|
Date :
2013-01-17 10:28:39 |
By :
namebom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คับ ลองแล้ว มันส่ง ค่า Vac_VacationID1 กลับมาคับ คือผมต้องการ จะ ให้มัน ceho ออกมา อ่าคับ
<input type="button" name="Submit1" value="บันทึก" id="Submit1" onClick="mySave1('<? echo $info ?>',
'<? echo date("m"); ?>','<? echo date("Y"); ?>"title="บันทึกข้อมูลใหม่"> นี้คือ ปุ่มบันทึก ตอนนี้ มัน echo วันเดือนปี ออกแล้ว ผมต้องการให้ echo ค่าที่ ยุ่วใน Vac_VacationID1 อ่าคับ
|
|
|
|
|
Date :
2013-01-17 10:36:16 |
By :
pongtave |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมงงงคำถามแล้วล่ะ ตกลงความต้องการมันยังไงครับ
|
|
|
|
|
Date :
2013-01-17 16:02:35 |
By :
namebom |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|