var pageHeight = 10294; var showScrollHeight = false; var maxY = 0; //タイマーイベントでスクロール位置を更新 document.body.onload=startRecordMaxY; function startRecordMaxY() { setInterval("recordMaxY1()",500); } function recordMaxY1() { tmpY = kl_sly(); if(tmpY>maxY) maxY = tmpY; if(showScrollHeight)window.status = tmpY;//現在の位置を表示する。 } //スクロールイベントでスクロール位置を更新 document.body.onscroll = recordMaxY2; function recordMaxY2() { tmpY = kl_sly(); if(tmpY>maxY) maxY = tmpY; if(showScrollHeight)window.status = tmpY;//現在の位置を表示する。 } //アンロードイベントでスクロール位置を送信 document.body.onunload = sendMaxY; function sendMaxY() { if( maxY <= pageHeight ) loadWebPage(); } function loadWebPage() { //alert("loadWebPageが呼び出されました。");//debug xmlhttp = createXMLHttpRequest(); if (xmlhttp) { requestData = "./readrate/write.php?maxY="+maxY//+query1+query2; xmlhttp.onreadystatechange = rr_check; xmlhttp.open("get", requestData, true); xmlhttp.send(null); } } function rr_check() { // if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { // document.getElementById("result").innerHTML = xmlhttp.responseText; // } } // XMLHttpオブジェクト作成 function createXMLHttpRequest() { var XMLhttpObject = null; try{ XMLhttpObject = new XMLHttpRequest(); }catch(e){ try{ XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try{ XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ return null; } } } return XMLhttpObject; }