Files
sqwtest01/WebContent/WEB-INF/pages/update.html

88 lines
2.0 KiB
HTML
Raw Normal View History

<HTML>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<title>EZParking Update Position</title>
<script language="JavaScript" type="text/javascript">
var searchReq = createAjaxObj();
function createAjaxObj()
{
var httprequest = false;
if (window.XMLHttpRequest)
{
httprequest = new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject)
{
try
{
httprequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
httprequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
}
}
}
return httprequest
}
function createQueryString()
{
var moduleID=document.getElementById("moduleID").value;
var statusAry = document.getElementsByName("statusId");
for(var i=0; i<statusAry.length; i++)
{
if(statusAry[i].checked)
{
var status=statusAry[i].value;
}
}
var queryString="moduleID=" + moduleID + "&status=" + status;
return queryString;
}
function updateStatus()
{
var queryString=createQueryString();
searchReq.open("POST", 'jqueryUpdateStatus', true);
searchReq.onreadystatechange = handleEZParkingStatus;
searchReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
searchReq.send(queryString);
}
function handleEZParkingStatus()
{
if (searchReq.readyState == 4)
{
alert("Update Successfully");
}
}
</script>
</head>
<Body>
<div class="div">
ModuleID:<input type="text" id="moduleID">
<br/>
Have Car:<input id="statusRadio" name="statusId" type="radio" value="1" />
&nbsp;&nbsp;
No Car:<input id="statusRadio" name="statusId" type="radio" value="0" />
<br/>
<button type="button" onClick="updateStatus()">Update</button>
<br/><br/>
<img src="position.jpg" width="600" height="700" />
</div>
</body>
</html>