大家好.
我请教一个问题,我写的程序是这样写的,可是出现错误.请大家帮我看看,谢谢
XTGL.js
// JScript 文件
var xmlhttp;
function Createxmlhttp()
{
//创建浏览器兼容的XMLHttpRequest对象
try
{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e)
{
try
{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e)
{
try
{
xmlhttp= new XMLHttpRequest();
}
catch(e){}
}
}
}function stopRole(code)
{
Createxmlhttp();
//定义XMLHttpRequest对象的事件处理程序
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
//当加载成功时将内容显示于页面
//content.innerHTML=xmlhttp.responseText;
alert(xmlhttp.responseText);
}
else
{
//否则弹出错误信息
alert(xmlhttp.status);
}
}
}
var Posturl = "XTGLCommon.aspx?RoleID="+code+;
alert(Posturl);
//创建一个连接
xmlhttp.open("get",Posturl);
//发送请求
xmlhttp.send(null);
}
//role.aspx 页面
<asp:GridView ID="GVRole" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="432px" OnPageIndexChanging="GVRole_PageIndexChanging" OnRowCommand="GVRole_RowCommand">
<Columns>
<asp:BoundField DataField="RoleID" HeaderText="角色编号" >
<ControlStyle Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="RoleName" HeaderText="角色名" >
<ControlStyle Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="RoleDescription" HeaderText="备注" >
<ControlStyle Width="150px" />
</asp:BoundField>
<asp:CheckBoxField DataField="Forbid" HeaderText="是否禁用" >
<ItemStyle HorizontalAlign="Center" />
</asp:CheckBoxField>
<asp:TemplateField HeaderText="禁用" ShowHeader="False">
<ItemTemplate>
<a href="javascript:void(0)" onclick='javascript:stopRole(<%# DataBinder.Eval(Container.DataItem,"RoleID") %>)'>停用</a>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="启用" ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="btnactive" runat="server" CausesValidation="false" CommandName="active" CommandArgument='<%# Eval("RoleID") %>'
ImageUrl="~/img/activelogin.gif" Text="启用" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<RowStyle BackColor="#DEDFDE" />
<HeaderStyle CssClass="headcenter" />
<AlternatingRowStyle BackColor="White" BorderColor="White" />
</asp:GridView>
后台的XTGLCommon.aspx是这样的
protected void Page_Load(object sender, EventArgs e)
{
SystemDataCommon.SetRole(Request.Form["RoleID"].ToString(), "", "", "F");
}
运行的时候点击role.aspx页面上的"禁用"时.有网页有提示错误.js也不在后面传输..
请问是哪里有问题呢,
我请教一个问题,我写的程序是这样写的,可是出现错误.请大家帮我看看,谢谢
XTGL.js
// JScript 文件
var xmlhttp;
function Createxmlhttp()
{
//创建浏览器兼容的XMLHttpRequest对象
try
{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}
catch(e)
{
try
{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e)
{
try
{
xmlhttp= new XMLHttpRequest();
}
catch(e){}
}
}
}function stopRole(code)
{
Createxmlhttp();
//定义XMLHttpRequest对象的事件处理程序
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
//当加载成功时将内容显示于页面
//content.innerHTML=xmlhttp.responseText;
alert(xmlhttp.responseText);
}
else
{
//否则弹出错误信息
alert(xmlhttp.status);
}
}
}
var Posturl = "XTGLCommon.aspx?RoleID="+code+;
alert(Posturl);
//创建一个连接
xmlhttp.open("get",Posturl);
//发送请求
xmlhttp.send(null);
}
//role.aspx 页面
<asp:GridView ID="GVRole" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="432px" OnPageIndexChanging="GVRole_PageIndexChanging" OnRowCommand="GVRole_RowCommand">
<Columns>
<asp:BoundField DataField="RoleID" HeaderText="角色编号" >
<ControlStyle Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="RoleName" HeaderText="角色名" >
<ControlStyle Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="RoleDescription" HeaderText="备注" >
<ControlStyle Width="150px" />
</asp:BoundField>
<asp:CheckBoxField DataField="Forbid" HeaderText="是否禁用" >
<ItemStyle HorizontalAlign="Center" />
</asp:CheckBoxField>
<asp:TemplateField HeaderText="禁用" ShowHeader="False">
<ItemTemplate>
<a href="javascript:void(0)" onclick='javascript:stopRole(<%# DataBinder.Eval(Container.DataItem,"RoleID") %>)'>停用</a>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="启用" ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="btnactive" runat="server" CausesValidation="false" CommandName="active" CommandArgument='<%# Eval("RoleID") %>'
ImageUrl="~/img/activelogin.gif" Text="启用" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<RowStyle BackColor="#DEDFDE" />
<HeaderStyle CssClass="headcenter" />
<AlternatingRowStyle BackColor="White" BorderColor="White" />
</asp:GridView>
后台的XTGLCommon.aspx是这样的
protected void Page_Load(object sender, EventArgs e)
{
SystemDataCommon.SetRole(Request.Form["RoleID"].ToString(), "", "", "F");
}
运行的时候点击role.aspx页面上的"禁用"时.有网页有提示错误.js也不在后面传输..
请问是哪里有问题呢,
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货