first commnit
This commit is contained in:
69
html/javascript/comment.js
Normal file
69
html/javascript/comment.js
Normal file
@ -0,0 +1,69 @@
|
||||
function ajaxObject() {
|
||||
var xmlHttp;
|
||||
try {
|
||||
// Firefox, Opera 8.0+, Safari
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
}
|
||||
catch (e) {
|
||||
// Internet Explorer
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (e) {
|
||||
alert("您的浏览器不支持AJAX!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xmlHttp;
|
||||
}
|
||||
function httppost ( url , data , fnSucceed ){// fnFail , fnLoading ) {
|
||||
var ajax = ajaxObject();
|
||||
ajax.open( "post" , url , true );
|
||||
// ajax.setRequestHeader( "Content-Type" , "application/octet-binary" );
|
||||
ajax.onreadystatechange = function () {
|
||||
if( ajax.readyState == 4 ) {
|
||||
if( ajax.status == 200 ) {
|
||||
|
||||
fnSucceed( ajax.response);
|
||||
|
||||
//ajax.response.size();
|
||||
}
|
||||
else {
|
||||
// fnFail( "HTTP请求错误!错误码:"+ajax.status );
|
||||
}
|
||||
}
|
||||
else {
|
||||
//fnLoading();
|
||||
}
|
||||
}
|
||||
// ajax.responseType="arraybuffer";
|
||||
ajax.send( data );
|
||||
|
||||
}
|
||||
function httpget ( url , data , fnSucceed ){// fnFail , fnLoading ) {
|
||||
var ajax = ajaxObject();
|
||||
ajax.open( "get" , url , true );
|
||||
// ajax.setRequestHeader( "Content-Type" , "application/octet-binary" );
|
||||
ajax.onreadystatechange = function () {
|
||||
if( ajax.readyState == 4 ) {
|
||||
if( ajax.status == 200 ) {
|
||||
|
||||
fnSucceed( ajax.response);
|
||||
|
||||
//ajax.response.size();
|
||||
}
|
||||
else {
|
||||
// fnFail( "HTTP请求错误!错误码:"+ajax.status );
|
||||
}
|
||||
}
|
||||
else {
|
||||
//fnLoading();
|
||||
}
|
||||
}
|
||||
// ajax.responseType="arraybuffer";
|
||||
ajax.send( data );
|
||||
|
||||
}
|
61
html/javascript/config.js
Normal file
61
html/javascript/config.js
Normal file
@ -0,0 +1,61 @@
|
||||
function getConfigRentrun(reson)
|
||||
{
|
||||
var aa=JSON.parse(reson);
|
||||
for (var obj in aa)
|
||||
{
|
||||
var temmp=document.getElementById(obj);
|
||||
temmp.value=aa[obj];
|
||||
if (obj=="GPS_North")
|
||||
{
|
||||
if (aa[obj]=="on")
|
||||
{
|
||||
temmp.checked=true;
|
||||
}else {
|
||||
temmp.checked=false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function getDevinfoRetrun(retrun)
|
||||
{
|
||||
var div=document.getElementById('devinfo');
|
||||
div.innerHTML=retrun;
|
||||
init()
|
||||
}
|
||||
function getstataRetrun(retrun){
|
||||
var div=document.getElementById('statid');
|
||||
div.innerHTML=retrun;
|
||||
}
|
||||
|
||||
|
||||
var datad;
|
||||
function init()
|
||||
{
|
||||
httpget("/php/GetConfig.php",datad,getConfigRentrun)
|
||||
|
||||
}
|
||||
|
||||
function getinit()
|
||||
{
|
||||
httpget("/php/GetIniFile.php",datad,getDevinfoRetrun)
|
||||
httpget("/php/GetSata.php",datad,getstataRetrun)
|
||||
}
|
||||
|
||||
function rebootclicked()
|
||||
{
|
||||
|
||||
httpget("/php/reboot.php",datad,getrebootRentrun)
|
||||
var div=document.getElementById('statid');
|
||||
div.innerHTML="";
|
||||
|
||||
}
|
||||
function getrebootRentrun(ret)
|
||||
{
|
||||
alert(ret)
|
||||
|
||||
setTimeout(() => {
|
||||
location.reload()
|
||||
}, 100);
|
||||
}
|
||||
window.onload=getinit;
|
Reference in New Issue
Block a user