Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Client Script Forum > ผมใช้ Datepicker แล้ว Onchange มันไม่ได้ค่าอะครับ แต่ Onclick , Onblur พวกนี้มัน เข้า Function น่ะครับ แต่ทำไม Onchange มันไม่ได้ค่าเลยอ่ะครับ



 

ผมใช้ Datepicker แล้ว Onchange มันไม่ได้ค่าอะครับ แต่ Onclick , Onblur พวกนี้มัน เข้า Function น่ะครับ แต่ทำไม Onchange มันไม่ได้ค่าเลยอ่ะครับ

 



Topic : 115355



โพสกระทู้ ( 586 )
บทความ ( 0 )



สถานะออฟไลน์




ผมใช้ Datepicker แล้ว Onchange มันไม่ได้ค่าอะครับ

แต่ Onclick , Onblur พวกนี้มัน เข้า Function น่ะครับ แต่ทำไม Onchange มันไม่ได้ค่าเลยอ่ะครับ



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-03-24 10:10:01 By : nut_ch31 View : 1100 Reply : 1
 

 

No. 1



โพสกระทู้ ( 586 )
บทความ ( 0 )



สถานะออฟไลน์


จาก Code ด้านล่าง ตรง Function onchange="duplicate(<?php echo $row_sel;?>)" อ่ะครับมันไม่เข้า Function แต่เปลี่ยนเป็น onclick อะไรพวกนี้มันเข้าน่ะครับ ควรทำอย่างไรดี ให้ ผมรับค่าได้

Code (PHP)
<?php require_once("promotion.php");?>

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

	<?php if($res==1){?>
		<h4 class="alert_success">Transaction Complete</h4>
		<form name="form2" method="post" action="promotion_query.php">
			<article id="add" class="module width_full">
					<header><h3>ADD/EDIT PROMOTION EARLY BIRD BY DAY</h3></header>
						<div class="module_content">
							<fieldset>	
								<label>HOTEL NAME </label><?php echo $r["name"];?>
							</fieldset>	
							<fieldset>	
								<label>SERVICE CODE </label><?php echo $r["service_code"];?>
							</fieldset>	
							<fieldset>	
								<label>CITY CODE </label><?php echo $r["city_code"];?>
							</fieldset>	
							<fieldset>	
								<label>MARKET </label><?php echo search_market($r["market_detail"]);?>
							</fieldset>	
							<fieldset>	
								<label>COMBINE PROMOTION </label>
								<input type="checkbox" name="combine_status" <?php if($r["combine_status"]==1){echo "checked";}?>>  COMBINE PROMOTION EARLY BIRD AND STAY PAY
							</fieldset>	
							<fieldset>	
									<?php //ADVANCE//
										  $sql="select * from ealry_bird where hotel_id='".$_REQUEST["hotel_id"]."' and type='advance' order by status DESC,no_id";
										  $query=mysql_query($sql);
										  $count_sel=mysql_num_rows($query);
										  $row_sel=0;
										  while($result=mysql_fetch_array($query)){?>
											<table class="tablesorter" width="100%">
												<tr>
													<th>Action</th>
													<th>Room</th>
													<th>Code</th>
													<th>By Day</th>
													<th>Start Date</th>
													<th>End Date</th>
													<th>Discount Room (%)</th>
													<th>Discount Abf</th>
													<th>Discount Extra Bed</th>
													<th>Nationality <br>
													<input type="checkbox" name="displayall<?php echo $row_sel;?>" onclick="display_all(this.form,<?php echo $row_sel;?>);"></th>
												</tr>
												<tr>								 					
													<td>
													<input type="hidden" id="no_id_sel<?php echo $row_sel;?>" name="no_id_sel[]" value="<?php echo $result["no_id"];?>">
													<?php if($result["status"]==1){?>
													<a title="Disable" target="_blank" onclick="check_disabled(<?php echo $result["no_id"];?>,'<?php echo $result["code"];?>')">Disable</a>
													<?php }else{?>
													<a title="Enable" target="_blank" onclick="check_enabled(<?php echo $result["no_id"];?>,'<?php echo $result["code"];?>')">Enable</a>
													<?php }?>
													</td>
													<td nowrap>
													<input type="hidden" id="room_id<?php echo $row_sel;?>">
													<?php echo search_room($result["room_id"]);?>
													</td>
													<td>
													<input type="text" name="code_sel[]" value="<?php echo $result["code"];?>" required>
													</td>
													<td>
													<input type="text" name="advance_sel[]" value="<?php echo $result["advance"];?>" onkeyup="isNumber(this)" required>
													</td>
													<td>
													<input type="text" id="travelling_from_sel<?php echo $row_sel;?>" name="travelling_from_sel[]" value="<?php echo change_format_date3($result["travelling_from"]);?>" onchange="duplicate(<?php echo $row_sel;?>)" required readonly>
													</td>
													<td>
													<input type="text" id="travelling_to_sel<?php echo $row_sel;?>"  name="travelling_to_sel[]" value="<?php echo change_format_date3($result["travelling_to"]);?>" onchange="duplicate(<?php echo $row_sel;?>)" required readonly>
													</td>
													<td>
													<input type="text" name="discount_sel[]" value="<?php echo $result["discount"];?>" required onkeyup="isNumber(this)">
													</td>
													<td>
													<input type="checkbox" name="check_discount_abf_sel<?php echo $row_sel;?>" <?php if($result["check_discount_abf"]==1){echo "checked";}?> value="1">
													</td>
													<td>
													<input type="checkbox" name="check_discount_extrabed_sel<?php echo $row_sel;?>" <?php if($result["check_discount_extrabed"]==1){echo "checked";}?> value="1">
													</td>
													<td>
													<input type="checkbox" name="checkall<?php echo $row_sel;?>" onclick="check_all(this.form,<?php echo $row_sel;?>);">All
													</td>	
												</tr>
												  <?php $array_market=explode("%",$result["market"]);?>			
												  <?php $sql_nal="select * from nationality where 1 order by name";
														$query_nal=mysql_query($sql_nal);
														$num_nal=mysql_num_rows($query_nal);
														$row_nal=0;
													?>
													<table width="100%" id="market_display<?php echo $row_sel;?>" style="display:none">
														  <?php
														  while($result_nal=mysql_fetch_array($query_nal)){?>
														  <?php if($row_nal%10==0){?>
															<tr>	
														  <?php }?>																
																<td width="10%">
																	<input type="checkbox" name="market_sel<?php echo $row_sel;?>_[<?php echo $row_nal;?>]" value="<?php echo $result_nal["name"];?>" <?php        if(in_array(trim($result_nal["name"]),$array_market)){ echo "checked";}?> ><br><?php echo $result_nal["name"];?>
																</td>
																<?php $row_nal++; ?>

														<?php if($row_nal%10==0){?>
															</tr>	
														  <?php }?>
													<?php 
														  } 
													?>
													</table>													
											</table>		
											<table class="tablesorter" width="100%">
												<tr>
													<td>&nbsp;</td>
												</tr>
											</table>
									<?php  $row_sel++; 
										  }?>								
							</fieldset>	
						</div>
					<footer>
						<div class="submit_link">	
							<input type="hidden" id="hotel_id" name="hotel_id" value="<?php echo $_REQUEST["hotel_id"];?>">
							<input type="hidden" name="count_sel" id="count_sel"  value="<?php echo $count_sel;?>">
							<input type="hidden" name="num_nal" value="<?php echo $num_nal;?>">
							<input type="hidden" name="mode" value="update_earlybird">
							<input type="hidden" id="config" name="config" value="0">
							<input type="submit" onclick="return check_submit_edit();" value="Add Promotion" class="alt_btn">
							<input type="submit" onclick="return check_submit();" value="Save" class="alt_btn">
							<input type="reset" value="Reset" onclick="return chk_reset();">
						</div>
					</footer>
				</article><!-- end of post new article -->
			<div class="spacer"></div>	
		</form>
	<?php }else{?>
		<h4 class="alert_error">Transaction Error</h4>
	<?php }?>	
	</section>	

</html>

<?php include("footer.php");?>

<?php
$sql2="select min(start_date) as start_date from contract_rate where hotel_id='".$_REQUEST["hotel_id"]."' ";
$query2=mysql_query($sql2);
$result2=mysql_fetch_array($query2);
$startdate_min=$result2["start_date"];

$sql3="select max(end_date) as end_date from contract_rate where hotel_id='".$_REQUEST["hotel_id"]."' ";
$query3=mysql_query($sql3);
$result3=mysql_fetch_array($query3);
$enddate_min=$result3["end_date"];
?>

<script language="javaScript">

	function duplicate(x){
			
			hotel_id =  $("#hotel_id").val();
			travelling_from_sel = $("#travelling_from_sel"+x).val();
			travelling_to_sel = $("#travelling_to_sel"+x).val();
			room_id = $("#room_id"+x).val();
			no_id_sel = $("#no_id_sel"+x).val();

			$.post('jquery_check_duplicate.php', { hotel_id : hotel_id , travelling_from_sel : travelling_from_sel , travelling_to_sel : travelling_to_sel , room_id : room_id , no_id_sel : no_id_sel , mode : 'promotion_early_bird' } ,function(res)
					{	
						if(res>0){
							alert("Cann't Save Because Start Date or End Date overlap.");							
						}
					});
	}

	function check_submit_edit(){
		if(confirm("Confirm Save & Add Promotion")){ 
			document.getElementById("config").value=0;
			return true;
		}else{
			return false;
		}
	}

	function check_submit(){
		if(confirm("Confirm Save")){
			document.getElementById("config").value=1;
			return true;
		}else{
			return false;
		}
	}

	function chk_reset(){
		if(confirm("Confirm Reset")){
			return true;
		}else{
			return false;
		}
	}

	function check_disabled(no_id,code){
		if(confirm("Confirm Disable Promotion "+code)){
			window.open ("promotion_query.php?mode=disabled_earlybird&no_id="+no_id,"mywindow");
		}
	}

	function check_enabled(no_id,code){
		if(confirm("Confirm Enable Promotion "+code)){
			window.open ("promotion_query.php?mode=enabled_earlybird&no_id="+no_id,"mywindow");
		}
	}

	function display_all(form,row_sel){

		if(form["displayall"+row_sel].checked==false){
			document.getElementById("market_display"+row_sel).style.display="none";
		}else{
			document.getElementById("market_display"+row_sel).style.display="";
		}
	}

	function check_all(form,row_sel){

		for(x=0;x<form.num_nal.value;x++){
			form["market_sel"+row_sel+"_["+x+"]"].checked=form["checkall"+row_sel].checked;							
		}
		
	}

	function isNumber(field) {
        var re = /^[0-9-'.']*$/;
        if (!re.test(field.value)) {
            alert('Value must be all numberic charcters, including "." non numerics will be removed from field!');
            field.value = field.value.replace(/[^0-9-'.']/g,"");
        }
    }

	var startdate_min = '<?php echo $startdate_min;?>'
	var enddate_min = '<?php echo $enddate_min;?>'
	
	for(x=0;x<form2.count_sel.value;x++){

			var a = x;

			var travelling_from_sel = "#travelling_from_sel";
			var travelling_from_sel = travelling_from_sel+a;

			var travelling_to_sel = "#travelling_to_sel";
			var travelling_to_sel = travelling_to_sel+a;

			$(travelling_from_sel).datepicker({
				dateFormat: 'dd/mm/yy',
				minDate: new Date(startdate_min),
				maxDate: new Date(enddate_min),
				numberOfMonths: 1,
				onSelect: function(selected) {

				  id = $(this).attr('id');		
				   
				  var lastChar = id.substr(id.length - 1);
				  var lastChar2 = "#travelling_to_sel"+lastChar;

				  $(lastChar2).datepicker("option","minDate", selected)
			   }
			});
			$(travelling_to_sel).datepicker({
				dateFormat: 'dd/mm/yy',
				minDate: new Date(startdate_min),
				maxDate: new Date(enddate_min),
				numberOfMonths: 1,
				onSelect: function(selected) {

				  id = $(this).attr('id');		
				   
				  var lastChar = id.substr(id.length - 1);
				  var lastChar2 = "#travelling_from_sel"+lastChar;

				   $(lastChar2).datepicker("option","maxDate", selected)
				}
			}); 
	}

</script>












ประวัติการแก้ไข
2015-03-24 10:22:00
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-03-24 10:20:04 By : nut_ch31
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ผมใช้ Datepicker แล้ว Onchange มันไม่ได้ค่าอะครับ แต่ Onclick , Onblur พวกนี้มัน เข้า Function น่ะครับ แต่ทำไม Onchange มันไม่ได้ค่าเลยอ่ะครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่