欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【aspx与ascx,ashx的用法总结】,下面是详细的讲解!
aspx与ascx,ashx的用法总结
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ASHXTest.aspx.cs" Inherits="ASHXTest" %>
<!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 runat="server">
<title>mytest</title>
<script type="text/javascript">
function $(s) { if (document.getElementById) { return eval('document.getElementById("' + s + '")'); } else { return eval('document.all.' + s); } }
function createXMLHTTP() {
var xmlHttp=false;
var arrSignatures=["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
"MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
"Microsoft.XMLHTTP"];
for (var i=0; i < arrSignatures.length; i++) {
try {
xmlHttp=new ActiveXObject(arrSignatures[i]);
return xmlHttp;
}
catch (oError) {
xmlHttp=false; //ignore
}
}
// throw new Error("MSXML is not installed on your system.");
if (!xmlHttp && typeof XMLHttpRequest !='undefined') {
xmlHttp=new XMLHttpRequest();
}
return xmlHttp;
}
var xmlReq=createXMLHTTP();
// 发送ajax处理请求(这里简单验证旧密码的有效性)
function validateOldPwd(oTxt) {
var url="/HandlerTest.ashx?action=modifyPwd&pwd=" + escape(oTxt.value); //.ashx文件
xmlReq.open("get", url, true);
xmlReq.setRequestHeader("If-Modified-Since", "0");
xmlReq.onreadystatechange=callBack;
xmlReq.send(url); // 发送文本
}
function callBack() {
if (xmlReq.readyState==4) {
if (xmlReq.status==200) {
alert(xmlReq.responseText); // 接收文本
}
else if (xmlReq.status==404) {
alert("Requested URL is not found.");
} else if (xmlReq.status==403) {
alert("Access denied.");
} else
alert("status is " + xmlReq.status);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="txtOldPwd" type="text" onblur="validateOldPwd(this)" />
</div>
</form>
</body>
</html>
关于aspx与ascx,ashx的用法总结的用户互动如下:
相关问题:
答: >>详细
相关问题:
答: >>详细
相关问题:
答: >>详细
- 【创建】ASP.NET Web API教程 创建域模型的方法详
- 【服务器】asp.net页面状态管理cookie和服务器状
- 如何取消.net后台线程的执行
- 【WeakReference】WeakReference(弱引用)让GC需要
- 【ajax格式】asp.net中在用ajax格式传递数据到asp
- 【字符文本】asp.net 数据绑定 使用eval 时候报
- 【Repeater控件】.NET实现Repeater控件+AspNetPag
- 【客户端】获取客户端IP地址c#/vb.net各自实现代
- 【asp】asp.net上传execl文件后 在页面上加载显示
- 【JSON】浅析JSON序列化与反序列化-序列化-反序列
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
