 |
รบกวนช่วยดูโค้ด Ajax ให้หน่อยครับ คือผมอยากให้ตรงส่วนที่เป็น from USD 160 per night มันอยู่ตรงตำแหน่ง You Result will Display Here ครับ |
|
 |
|
|
 |
 |
|
ช่วยหน่อยนะครับ
|
 |
 |
 |
 |
Date :
2010-01-26 20:22:39 |
By :
gungrave |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2010-01-26 22:13:59 |
By :
gungrave |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยหน่อยนะครับ
|
 |
 |
 |
 |
Date :
2010-01-27 01:48:26 |
By :
gungrave |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วทำไมตรงนี้ต้องเอาไว้ในลูป white ด้วยอ่ะคับ
<div id='area'>Your result will display here</div>
|
 |
 |
 |
 |
Date :
2010-01-27 08:15:24 |
By :
ความรู้เท่าหางอึ่ง |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลูปข้อมูลใน serversay.php แล้วค่อยเอามาแสดงครับ
|
 |
 |
 |
 |
Date :
2010-01-27 08:16:56 |
By :
ความรู้เท่าหางอึ่ง |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังไม่ค่อยเข้าใจความต้องการของคุรเท่าไหร่นักนะคะ
แต่ก็คิดว่าน่าจะเป็นเพราะมีการ loop สร้าง <div id='area'></div> หลายตัว
ลองเอา <div id='area'></div> ไว้นอก loop นะคะ
<div id='area'>
<?php
while($r=mysql_fetch_array($result)) {
echo "Your result will display here";
}
?>
</div>
|
 |
 |
 |
 |
Date :
2010-01-27 08:55:33 |
By :
ultrasiam |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือผมต้องการให้มันเป็นแบบนี้ครับ

แต่ผมทำแล้วเป็นแบบนี้ครับ

อันนี้โค้ดครับ
SearchResults.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Search Results</title>
<link type="text/css" href="jquery-ui-1.7.2.custom/development-bundle/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="jquery-ui-1.7.2.custom/development-bundle/jquery-1.3.2.js"></script>
<script type="text/javascript" src="jquery-ui-1.7.2.custom/development-bundle/ui/ui.core.js"></script>
<script type="text/javascript" src="jquery-ui-1.7.2.custom/development-bundle/ui/ui.datepicker.js"></script>
<link type="text/css" href="jquery-ui-1.7.2.custom/development-bundle/demos/demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function(){
$("#Checkin").datepicker({minDate:'Today' , showButtonPanel: true , showOn: 'button', buttonText: 'Choose' , buttonImage: 'images/calender-img.gif', buttonImageOnly: true});
$("#Checkout").datepicker({minDate:'#datepicker' , showButtonPanel: true , showOn: 'button', buttonText: 'Choose' , buttonImage: 'images/calender-img.gif', buttonImageOnly: true});
});
</script>
<style type="text/css">
<!--
.style2 {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #333333;
}
.style3 {color: #FFFFFF}
.style4 {
font-family: Tahoma;
font-size: 14px;
color: #0066FF;
font-weight: bold;
}
.style5 {
font-size: 14px;
color: #333333;
font-family: Tahoma;
}
.style6 {
font-size: 14px;
font-weight: bold;
}
.style8 {font-size: 14px; font-weight: bold; color: #BF0B2F; }
-->
</style>
<script>
function insertList(num){
var xloop=num*4;
var yloop=num*3;
var list=document.form3.Adult;
var list2=document.form3.Children;
list.innerHTML=""
list2.innerHTML=""
var op=document.createElement('option');
for(x=0;x<xloop;x++){
list.options[x] = new Option((x+1),(x+1));
}
for(y=0;y<=yloop;y++){
list2.options[y] = new Option(y,y);
}
}
</script>
<script language="javascript" type="text/javascript">
<!--
//Browser Support Code
function send()
{
var ajaxRequest;
try{
ajaxRequest = new XMLHttpRequest();
} catch (e){
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Your browser broke!");
return false;
}
}
}
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4)
{
var area = document.getElementById('area');
area.innerHTML = ajaxRequest.responseText;
}
}
var name = document.getElementById('Select').value;
ajaxRequest.open("GET", "serversay.php?" + "name=" + name , true);
ajaxRequest.send(null);
}
//-->
</script>
</head>
<?
$Checkin = $_GET["Checkin"];
$Checkout = $_GET["Checkout"];
$Rooms = $_GET["Rooms"];
$Adult = $_GET["Adult"];
$Children = $_GET["Children"];
$City=$_GET ['City'] ;
include "Connect.php";
include "Currency.php";
$sql="SELECT * FROM hotel inner join roomtype on hotel.id_Hotel=roomtype.id_Hotel where City='$City' GROUP BY hotel.id_Hotel";
$result=mysql_db_query($dbname,$sql);
?>
<body>
<table width="955" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="903" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><img src="images/Head.png" width="955" height="323" /></div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="857" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"><form id="form3" name="form3" method="get" action="">
<table width="749" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td class="style5"><table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10" colspan="5" class="style2"><img src="images/spacer.gif" width="1" height="1" /></td>
</tr>
<tr>
<td height="30" colspan="5" class="style2"><span class="style8">Check Rate & Availabilty</span></td>
</tr>
<tr>
<td width="200" height="20" class="style2">Check-in</td>
<td width="200" height="20" class="style2">Check-out</td>
<td width="115" height="20" class="style2"><div align="center">Rooms</div></td>
<td width="79" height="20" class="style2"><div align="center">Adult</div></td>
<td width="106" height="20" class="style2"><div align="center">Children (2-11)</div></td>
</tr>
<tr>
<td height="30" class="style2"><input type="text" id="Checkin" name="Checkin" readonly="true" value="<?=$Checkin?>"></td>
<td height="30" class="style2"><input type="text" id="Checkout" name="Checkout" readonly="true" value="<?=$Checkout?>"></td>
<td height="30" class="style2"><div align="center">
<select name="Rooms" onchange="insertList(this.value)">
<?
for ($i=1;$i<=3;$i++){
if ($Rooms == $i) {
echo "<option value='$i' SELECTED>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
?>
</select>
</div></td>
<td height="30" class="style2"><div align="center">
<select name="Adult" id="Adult">
<?
echo "<option value='$Adult' SELECTED>$Adult</option>";
?>
</select>
</div></td>
<td height="30" class="style2"><div align="center">
<select name="Children" id="Children">
<?
echo "<option value='$Children' SELECTED>$Children</option>";
?>
</select>
</div></td>
</tr>
<tr>
<td height="10" colspan="5" class="style2"><img src="images/spacer.gif" width="1" height="1" /></td>
</tr>
</table> </td>
</tr>
</table>
</form> </td>
</tr>
<tr>
<td height="10"><img src="images/spacer.gif" width="1" height="1" /></td>
</tr>
<tr>
<td><form name="form2" id="form2" method="get" action="">
<div align="right">
<select name="Select"onChange="send();">
<option value="0">-- Change Currency --</option>
<?
include "Currency.php";
for ($i=1;$i<=count($Currency);$i++){
echo "<option value='$Currency[$i]'>$Currency[$i]</option>";
}
?>
</select>
</div>
</form></td>
</tr>
<tr>
<td height="5"><img src="images/spacer.gif" width="1" height="1" /></td>
</tr>
</table></td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="">
<?
while($r=mysql_fetch_array($result)) {
?>
<table width="855" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td><table width="855" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="100"><div align="center"><img src="images_thumbs-hotel/<?=$r["Thumbnails"];?>" border="0" align="middle" /></div></td>
<td width="655" rowspan="2"><table width="620" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><a href="Hotel.php?id_Select=<?=$r["id_Hotel"];?>&id_Currency=<?=$_GET["id_Currency"]?>" class="style6 style4"style="text-decoration: none; "color:#FFFFFF;"> <?=$r["Hotel_name"];?></a> </td>
</tr>
<tr>
<td height="10"><img src="images/spacer.gif" width="1" height="1" /></td>
</tr>
<tr>
<td width="620"><div align="justify" class="style2"><? echo nl2br("$r[Details]"); ?></div></td>
</tr>
<tr>
<td height="10"><img src="images/spacer.gif" width="1" height="1" /></td>
</tr>
</table></td>
<td width="80" rowspan="2" bgcolor="#2F2F2D"><div align="center" class="style3 style5"><a href="Hotel.php?id_Select=<?=$r["id_Hotel"];?>&id_Currency=<?=$_GET["id_Currency"]?>&Checkin=<?=$_GET["Checkin"]?>&Checkout=<?=$_GET["Checkout"]?>&Rooms=<?=$_GET["Rooms"]?>&Adult=<?=$_GET["Adult"]?>&Children=<?=$_GET["Children"]?>" class="style6 style3"style="text-decoration: none; "color:#FFFFFF;"> Select </a></div></td>
</tr>
<tr>
<td><table width="100" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td><div align="center" class="style2">
<?
if($id_Currency=="Euro (EUR)"){
$sql="SELECT MIN(Price_EUR) AS MinPrice_EUR FROM roomtype";
echo "from EUR $r[Price_EUR] <br> per night";
} else {
$sql="SELECT MIN(Price_USD) AS MinPrice_USD FROM roomtype ";
echo "from USD $r[Price_USD] <br> per night";
}
?>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="855" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="10"><img src="images/spacer.gif" width="1" height="1" /></td>
</tr>
</table>
<?
}
?>
</form> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
|
 |
 |
 |
 |
Date :
2010-01-27 14:25:47 |
By :
gungrave |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2010-01-28 00:31:28 |
By :
gungrave |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เหมือนมี loop ซ้อนเลยนะคะ
|
 |
 |
 |
 |
Date :
2010-01-28 08:34:16 |
By :
ultrasiam |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|