满意答案

dcebd7a0de6265b6ccae5ead692f1eab.png

wkls1314

2013.04.18

dcebd7a0de6265b6ccae5ead692f1eab.png

采纳率:56%    等级:12

已帮助:13866人

.ashx文件[WebService(Namespace = " http://***.org/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

public class SharperHandler : IHttpHandler

{        public void ProcessRequest(HttpContext context)

{

SqlDataReader dr=new ToolrCtrl().SharpeneinfoReturn(context.Request["id"].Trim());

if (dr.Read())

{

context.Response.Write(string.Format("{0}$$${1}$$${2}"

, dr["makerno"].ToString(),dr["regfee"].ToString(),dr["reglead"].ToString()));///返回一个多个参数的字符串

}

else

{

context.Response.Write("0");

}

}前台function createXMLHttpRequest() {

if (window.XMLHttpRequest) return new XMLHttpRequest();

try { return new ActiveXObject('MSXML2.XMLHTTP.4.0'); }

catch (e) {

try { return new ActiveXObject('MSXML2.XMLHTTP.3.0'); }

catch (e) {

try { return new ActiveXObject('MSXML2.XMLHTTP.2.6'); }

catch (e) {

try { return new ActiveXObject('MSXML2.XMLHTTP'); }

catch (e) {

try { return new ActiveXObject('Microsoft.XMLHTTP'); }

catch (e) { return null; }

}

}

}

}

} ///ajax验证tid是否存在及返回产品信息

function checktbxDescription() {    var tbxDescription = document.getElementById("tid").value;

chkXML = createXMLHttpRequest();

if (chkXML == null) { top.MessageBox.show("info", "你的浏览器不支持XmlHttpRequest,请更新!", null, null); return false; }

chkXML.open("GET", "validate/SharperHandler.ashx?id=" + tbxDescription, true);

chkXML.onreadystatechange = function() {

if (chkXML.readyState == 4) {

if (chkXML.status == 200) {

if (chkXML.responseText == "0") {

alert("[温馨提示]该研磨编号不存在或无效,请重新输入!");

document.getElementById("tid").select();

document.getElementById("tid").value = "";

return false;

}

else {

var result=chkXML.responseText;

if (result != null)

{

var val = result.split('$$$');

$("txtProPrice").value = (parseFloat(val[1])).toFixed(2);

var today = new Date();

var day = today.getDate();

var month = today.getMonth() + 1;

var year = today.getYear();

var date = year + "-" + month + "-" + day;

var ss=parseInt(val[2]);

date = DateAdd(date,ss);

$("txtdate").value = date;

}

document.getElementById("tid").select();

return true;

}

}

}

}

chkXML.send(null);

return true;

}

01分享举报

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐