|
|
|
ผมใช้ ajax ในการกดเมนูเพื่อแสดงหน้าเกรด แล้วกดปุ่มแสดงข้อมูล แต่มันแสดงเกรดอย่างเดียวเมนูหาย |
|
|
|
|
|
|
|
โค๊ดเต็มๆๆ
|
|
|
|
|
Date :
2011-08-23 11:31:07 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (JavaScript)
<script language="JavaScript" type="text/javascript">
var HttPRequest = false;
function doCallAjax(url) {
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 pmeters = "";
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>
Html
Code (ASP)
<div class="block" style="padding-top: 1em;">
<ul class="tabs primary"><li class="info"><a href="JavaScript:doCallAjax('info.aspx');" target="_parent">ข้อมูลทั่วไป</a></li><li class="grade"><a href="JavaScript:doCallAjax('grade.aspx');" target="_parent">ผลการเรียนสามัญ</a></li><li class="grade2"><a href="JavaScript:doCallAjax('grade2.aspx');" target="_parent">ผลกาเรียนเสริม</a></li><li class="table"><a href="JavaScript:doCallAjax('table.aspx');" target="_parent">ตารางเรียน</a></li></ul>
<div class="blockIframe"><span id="mySpan"></span></div>
|
|
|
|
|
Date :
2011-08-23 11:39:58 |
By :
hamdeen |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|