<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<script language="javascript">
var xmlhttp = false;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e2){
xmlhttp = false;
}
}
function callServer()
{
var rolename=document.getElementById("rolename").value;
var roletype=document.getElementById("roletype").value;
if(rolename==null||rolename=="")
{
document.getElementById("rolename").focus();
return false;
}
if(roletype==null||roletype=="")
return false;
var url="updateRole.do?rolename="+rolename+"&roletype="+roletype;
xmlhttp.open("get",url,true);
xmlhttp.onreadystatechange = updatePage;
xmlhttp.send(null);
}
function updatePage()
{
if(xmlhttp.readyState==4){
var response = xmlhttp.responseText;
if(response=="success")
{
alert("插入数据成功!");
document.getElementById("rolename").value="";
}
else
{
alert("失败!");
}
}
}
</script>
<body>
<table width="400" border="1">
<tr>
<td>角色名称</td>
<td>
<input type="text" id="rolename" />
</td>
</tr>
<tr>
<td>角色类型</td>
<td><input type="text" value="0" id="roletype"/></td>
</tr>
<tr>
<td>提交</td>
<td><input type="button" value="submit" οnclick="callServer();" name="bt"/></td>
</tr>
</table>
</body>
</html>