|
 |
|
วิธีเวลาเลือกปฏิทินแล้วส่งค่าไป textbox ทำอย่างไรคะ |
|
 |
|
|
 |
 |
|
ต้องไปดู ที่ๆโหลดสคิปมาครับว่ามีส่วนของโค๊ตที่ ให้นำไปใช้ต่อหรือไม่้ กับอีกอย่าง แก้ใน script ของ ui เองครับ
ลองไปดูที่โหลดมาก่อนถ้าไม่มีจริงๆ ลองเอา โค๊ตในสคิปมาดูครับเผื่อช่วยได้
|
 |
 |
 |
 |
Date :
2012-08-12 14:56:06 |
By :
taza678 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (JavaScript)
$("#date").datepicker(); //กำหนด selector ที่ชื่อไิอดีของอินพุทครับ
|
 |
 |
 |
 |
Date :
2012-08-12 15:00:16 |
By :
Pine |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ้อ ขออภัยครับ ผมนึกว่าคลิกที่อินพุทแล้วเลือกวันที่
Code (JavaScript)
$("#Calendar").datepicker({
onClose:function(){
$('#date').val($(this).val());
},
onSelect: function(){
$('#date').val($(this).val());
}
});
ยังไม่ได้ลองนะครับ แหะๆๆ
|
 |
 |
 |
 |
Date :
2012-08-12 15:42:01 |
By :
Pine |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองแล้วโอเคครับ
Code (JavaScript)
<script type="text/javascript">
$(function(){
$("#Calendar").datepicker({
onSelect: function(){
$('#date').val($(this).val());
}
});
});
</script>
ลดเหลือแค่ onSelect ก็ได้ครับ เพราะไม่ได้ปิดปฏิทิน
|
 |
 |
 |
 |
Date :
2012-08-12 15:50:24 |
By :
Pine |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<input type="text" name="date" id="date" />
ต้องใช้ ID ของ Input เป็น Selector นะครับ
Code (PHP)
<!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>Untitled Document</title>
<link href="flick/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="392" height="84" border="0" align="center">
<tr>
<td width="88">วัน/เดือน/ปี</td>
<td width="294">
<input type="text" name="date" id="date" />
</td>
</tr>
<tr>
<td> </td>
[color=purple]<td><div id="Calendar">
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.22.custom.js"></script>
<script> $(function(){
$("#date").datepicker(); });</script>
</div></td>
</tr>
</table>
</form>
</body>
</html>
|
 |
 |
 |
 |
Date :
2012-08-12 17:13:52 |
By :
Krungsri |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณพี่ๆทุกคนนะคะ เมพขิงๆๆๆๆ 
|
 |
 |
 |
 |
Date :
2012-08-12 19:14:12 |
By :
custer |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่ๆคนไหนพอทราบวิธีการส่งค่าผ่านพารามิเตอร์ทาง textbox โดยไม่มีปุ่ม submit ใดๆไหมคะ
คือหนูทำปฏิทินเหมือนกัน แต่ต้องการแยกฟังก์ชันออกมาเพื่อให้ผู้อื่นสามารถเรียกใช้ได้ด้วย
แต่ปัญหาคือ ฟังก์ชัน popupcalendar จะทำงานก็ต่อเมื่อมีการเรียกชื่อ id เดียวกันกับ textbox
อย่างที่พี่ได้สอนมาข้างต้น แต่ถ้าเกิดกรณีที่ในหน้าฟอร์มของ textbox นั้น มีหลาย textbox
หลาย id จะทำอย่างไรคะ (คิดว่าต้องส่งพารามิเตอร์อย่างเดียว)
แต่ในไฟล์ที่หนูแสดงให้ดู เป็นไฟล์ที่สามารถส่งค่าพารามิเตอร์ได้ (เพราะหนูแอบใส่รูปเพื่อทำ link
ไปที่ฟังก์ชัน) แต่ปัญหาก็มีอีก คือในฟังก์ชัน popupCalendar มันก็ไปเรียกไฟล์รูปมาแสดงอีกที
รบกวนด้วยนะคะ ยาวหน่อย แต่ก็เพราะกลัวพี่ๆไม่เข้าใจคำถาม ขอบคุณค่ะ
ไฟล์ calendar02.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@page
language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<LINK rel="stylesheet" href="<%=request.getContextPath()%>/theme/Main.css" type="text/css">
<LINK rel=stylesheet href="<%=request.getContextPath()%>/jquery/css/jquery.ui.all.css">
<SCRIPT type=text/javascript src="<%=request.getContextPath()%>/jquery/js/jquery-1.4.2.js"></SCRIPT>
<SCRIPT type=text/javascript src="<%=request.getContextPath()%>/jquery/js/jquery.ui.core.js"></SCRIPT>
<SCRIPT type=text/javascript src="<%=request.getContextPath()%>/jquery/js/jquery.ui.datepicker.js"></SCRIPT>
<SCRIPT type=text/javascript src="<%=request.getContextPath()%>/jquery/js/calendarFunc02.js"></SCRIPT>
</head>
<body>
<table>
<tr>
<td align="right">
From :
</td>
<td colspan="3" align="left">
<INPUT type="text" id=dateFrom1 name="dateFrom" class="datepicker" value="" size="9" readonly="readonly">
<a href="javascript:popupCalendar('dateFrom1', 'dateTo1');"><img src=cal.gif></a>
-
<td align="right">
To :
</td>
<td colspan="3" align="left">
<INPUT type="text" id=dateTo1 name="dateTo" class="datepicker" value="" size="9" readonly="readonly">
<a href="javascript:popupCalendar('dateFrom1', 'dateTo1');"><img src=cal.gif></a>
</td>
</tr>
</table>
</body>
</html>
ไฟล์ calendarFunc02.js
$(function popupCalendar(id1,id2){
var dates = $('#'+id1+',#'+id2).datepicker({
showOn: 'button',
buttonImage: 'jquery/images/cal.gif',
buttonImageOnly: true,
showAnim: 'slideDown',
dateFormat: 'dd-mm-yy',
//minDate: 0,
//defaultDate: "+1w",
changeMonth: true,
changeYear: true,
numberOfMonths: 1,
onSelect: function(selectedDate) {
var option = this.id == id1 ? "minDate" : "maxDate";
var instance = $(this).data("datepicker");
var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
dates.not(this).datepicker("option", option, date);
}
});
});
|
 |
 |
 |
 |
Date :
2012-08-21 11:47:21 |
By :
GooGoy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำเป็นกระทู้ใหม่ดีกว่าครับ แล้วอธิบายอีกรอบนะครับ ผมยังไม่ค่อยเข้าใจ แหะๆๆ
|
 |
 |
 |
 |
Date :
2012-08-21 11:55:03 |
By :
Pine |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมต้องการปฏิทิน ใช้สำหรับการรับสมัครพนักงาน
โดยกำหนดอายุพนักงาน เกิดระหว่าง วันที่ 1 ม.ค.2540 ถึง 31 ธ.ค.44
ทดลองปรับแต่ง Code แล้ว ยังไม่ประสบความสำเร็จ
ท่านใดมีคำแนะนำ บ้างหรือไม่ครับ
|
 |
 |
 |
 |
Date :
2018-09-12 09:09:47 |
By :
ปิยะณัฐ ภัทรพล |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|