|
|
|
มีปัญหาใน ie ครับ ผมใช้ ie9 แล้วมันไม่รันแบบ real time ให้อะครับ browser อื่่นไม่มีปัญหาครับ |
|
|
|
|
|
|
|
ลองกับ Browser อื่นๆ แล้วไช่ไหมครับ?
|
|
|
|
|
Date :
2012-11-21 11:20:19 |
By :
ALTELMA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ครับลองแล้ว chrome ลองแล้วครับ
โทษทีครับ firefox ก็ใช้ไม่ได้ครับ
|
ประวัติการแก้ไข 2012-11-21 11:27:22
|
|
|
|
Date :
2012-11-21 11:21:35 |
By :
wizardscurse |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมลองก็ปกติน่ะครับ
|
|
|
|
|
Date :
2012-11-21 11:42:51 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รบกวนเอาโค้ดมาให้ดูหน่อยได้ไหมครับ? CODE ที่ใช้อยู่นะครับ ไม่ไช่โค้ดตามตัวอย่าง
|
|
|
|
|
Date :
2012-11-21 12:35:54 |
By :
ALTELMA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ajax ไม่ทำงานหรือเปล่าครับ ?
|
|
|
|
|
Date :
2012-11-21 12:54:01 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมพอจะทราบล่ะครับแต่มีปัญหาเรื่อง cache ของ browser อะครับ
ข้อมูลผมไม่อัฟเดตอะครับ
เวลาก็เดินตามปกติน่ะครับแต่ค่าที่ผมดึงมาจาก db
มันไม่เปลี่ยนแปลงอะครับ
ปกติน้ำต้องลดแต่มันไม่ลดอะครับ เนื่องจาก browser มันจำ cacheอะครับ
ไม่ทราบว่าต้องทำยังไงหรอครับ
|
|
|
|
|
Date :
2012-11-21 13:24:53 |
By :
wizardscurse |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
นี้ครับ code
Code (PHP)
<html>
<head>
<title>WATER LEVEL</title>
</head>
<script language="JavaScript">
var HttPRequest = false;
function doCallAjax(Sort) {
HttPRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
HttPRequest = new XMLHttpRequest();
if (HttPRequest.overrideMimeType) {
HttPRequest.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!HttPRequest) {
alert('Cannot create XMLHTTP instance');
return false;
}
var url = 'AjaxPHPRealtime2.php';
var pmeters = 'mySort='+Sort;
HttPRequest.open('POST',url,true);
HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HttPRequest.setRequestHeader("Content-length", pmeters.length);
HttPRequest.setRequestHeader("Connection", "close");
HttPRequest.send(pmeters);
HttPRequest.onreadystatechange = function()
{
if(HttPRequest.readyState == 3) // Loading Request
{
document.getElementById("mySpan").innerHTML = "Now is Loading...";
}
if(HttPRequest.readyState == 4) // Return Request
{
document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
}
}
}
</script>
<body Onload="bodyOnload();">
<h1>WATER LEVEL</h1>
<form name="frmMain" action="" method="post">
<script language="JavaScript">
function bodyOnload()
{
doCallAjax();
setTimeout("doLoop();",1000);
}
function doLoop()
{
bodyOnload();
}
</script>
<span id="mySpan"></span>
</body>
</html>
=====================================================================================
Code (PHP)
<?php
#////////////////////////////////////////////////////////
#//////////////////// CREATE IMAGE //////////////////////
#////////////////////////////////////////////////////////
echo "<img src=image.png>";
$filname = "UR.gif";
$src = ImageCreateFromGif($filname);
$size = GetImageSize($filname);
$im = ImageCreate(600, 300);
#////////////////////////////////////////////////////////
#/////////////////////// COLOR //////////////////////////
#////////////////////////////////////////////////////////
$bg = ImageColorAllocate($im, 255, 255, 255);
$blue = imagecolorallocate($im, 65, 105, 225);
$red = imagecolorallocate($im, 255, 0, 0);
$black = imagecolorallocate($im, 0, 0, 0);
#////////////////////////////////////////////////////////
#///////////////////// CONNECT DB ///////////////////////
#////////////////////////////////////////////////////////
$dsn = "";
$login = "sa";
$pwd = "";
$conn = odbc_connect($dsn, $login, $pwd);
#////////////////////////////////////////////////////////
#//////////////////////// UPDAME ////////////////////////
#////////////////////////////////////////////////////////
$Sql = "SELECT TOP 1 WATERLEVEL FROM WL_TU05 WHERE WATERLEVEL > 0 OR WATERLEVEL != NULL ORDER BY DATE_TIME DESC";
$dbquery=odbc_exec($conn,$Sql);
$objResult = odbc_fetch_array($dbquery);
$n = number_format($objResult['WATERLEVEL'], 2 , '.', '');
#////////////////////////////////////////////////////////
#///////////////// NORMAL ELEVATION /////////////////////
#////////////////////////////////////////////////////////
if($n>=175.00 && $n <= 182.00){
$scale = number_format(225 - (($n - 175.00)*100)/6.3636, 2, '.', '');
$draw_1 = array (0, $scale,350,$scale,350,225,0,225);
$draw_2 = array (0, 225, 350, 225, 350, 250, 0, 250);
$draw_3 = array (190, $scale-10, 210, $scale-10, 200, $scale);
imagepolygon($im, $draw_1 , 4, $bg);
imagepolygon($im, $draw_2 , 4, $bg);
imagepolygon($im, $draw_3 , 3, $bg);
imagefilledpolygon($im, $draw_1, 4, $blue);
imagefilledpolygon($im, $draw_2, 4, $blue);
imagefilledpolygon($im, $draw_3, 3, $black);
imageline( $im, 190, $scale+2, 210, $scale+2, $black );
imageline( $im, 193, $scale+4, 207, $scale+4, $black );
imageline( $im, 196, $scale+6, 204, $scale+6, $black );
}
#////////////////////////////////////////////////////////
#////////////////// HIGHT ELEVATION /////////////////////
#////////////////////////////////////////////////////////
if($n > 182.00){
$scale = number_format(115 - (($n - 182.00)*100)/15, 2, '.', '');
$draw_1 = array (0, 115,350,115,350,225,0,225);
$draw_2 = array (0, 225, 350, 225, 350, 250, 0, 250);
$draw_3 = array (350, $scale,0,$scale,0,115,350,115);
$draw_4 = array (190, $scale-10, 210, $scale-10, 200, $scale);
imagepolygon($im, $draw_1 , 4, $bg);
imagepolygon($im, $draw_2 , 4, $bg);
imagepolygon($im, $draw_3 , 4, $bg);
imagepolygon($im, $draw_4 , 3, $bg);
imagefilledpolygon($im, $draw_1, 4, $blue);
imagefilledpolygon($im, $draw_2, 4, $blue);
imagefilledpolygon($im, $draw_3, 4, $red);
imagefilledpolygon($im, $draw_4, 3, $black);
imageline( $im, 190, $scale+2, 210, $scale+2, $black );
imageline( $im, 193, $scale+4, 207, $scale+4, $black );
imageline( $im, 196, $scale+6, 204, $scale+6, $black );
}
#////////////////////////////////////////////////////////
#//////////////////// LOW ELEVATION /////////////////////
#////////////////////////////////////////////////////////
if($n < 175.00){
$scale = number_format(250 - (($n - 172.00)*100)/12, 2, '.', '');
$draw_1 = array (0, $scale, 350, $scale, 350, 250, 0, 250);
$draw_2 = array (190, $scale-10, 210, $scale-10, 200, $scale);
imagepolygon($im, $draw_1 , 4, $bg);
imagepolygon($im, $draw_2 , 3, $bg);
imagefilledpolygon($im, $draw_1, 4, $red);
imagefilledpolygon($im, $draw_2, 3, $black);
imageline( $im, 190, $scale+2, 210, $scale+2, $black );
imageline( $im, 193, $scale+4, 207, $scale+4, $black );
imageline( $im, 196, $scale+6, 204, $scale+6, $black );
}
#////////////////////////////////////////////////////////
#/////////////////////// DOWNDAM ////////////////////////
#////////////////////////////////////////////////////////
$Sql = "SELECT TOP 1 TD05_WL FROM WL_DISCH_15MIN WHERE TD05_WL > 0 OR TD05_WL != NULL ORDER BY DATE_TIME DESC";
$dbquery=odbc_exec($conn,$Sql);
$objResult = odbc_fetch_array($dbquery);
#////////////////////////////////////////////////////////
#/////////////////// WATER ELEVATION ///////////////////
#////////////////////////////////////////////////////////
$n1 = number_format($objResult['TD05_WL'], 2 , '.', '');
$scale = number_format(286 - (($n1 - 140.00)*100)/69.4444, 2, '.', '');
$draw_1 = array (380, $scale,600,$scale,600,286,380,286);
$draw_2 = array (520, $scale-10, 540, $scale-10, 530, $scale);
imagepolygon($im, $draw_1 , 4, $bg);
imagepolygon($im, $draw_2 , 3, $bg);
imagefilledpolygon($im, $draw_1, 4, $blue);
imagefilledpolygon($im, $draw_2, 3, $black);
imageline( $im, 520, $scale+2, 540, $scale+2, $black );
imageline( $im, 523, $scale+4, 537, $scale+4, $black );
imageline( $im, 526, $scale+6, 534, $scale+6, $black );
#////////////////////////////////////////////////////////
#///////////////////////// STORAGE /////////////////////
#////////////////////////////////////////////////////////
$Sql = "SELECT TOP 1 STORAGE FROM WL_TU05 WHERE WATERLEVEL > 0 OR WATERLEVEL != NULL ORDER BY DATE_TIME DESC";
$dbquery=odbc_exec($conn,$Sql);
$objResult = odbc_fetch_array($dbquery);
$n2 = number_format($objResult['STORAGE'], 2 , '.', '');
#////////////////////////////////////////////////////////
#//////////////////////// 2 IMAGE ///////////////////////
#////////////////////////////////////////////////////////
ImageCopy($im, $src, 0, 0, 0, 0, $size[0], $size[1]);
$draw_1 = array (459, 6, 593, 6, 593, 45, 459, 45);
$draw_2 = array (457, 4, 595, 4, 595, 47, 457, 47);
$draw_3 = array (0, 0, 599, 0, 599, 299, 0, 299);
imagepolygon($im, $draw_1 , 4, $red);
imagepolygon($im, $draw_2 , 4, $red);
imagepolygon($im, $draw_3 , 4, $black);
#////////////////////////////////////////////////////////
#//////////////////// DESTROY IMAGE /////////////////////
#////////////////////////////////////////////////////////
ImagePng($im,"image.png");
ImageDestroy($src);
ImageDestroy($im);
odbc_close($conn);
?>
|
ประวัติการแก้ไข 2012-11-21 13:29:00
|
|
|
|
Date :
2012-11-21 13:27:54 |
By :
wizardscurse |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|