ת JavaScriptµ÷ÓÃWebServices(ʹÓÃWebService.htc)
.XML Web services ÐÐΪʹ¿Í»§¶Ë½Å±¾Äܹ»µ÷ÓÃÓÉ Microsoft .NET XML Web services »òÆäËûÖ§³Ö¼òµ¥¶ÔÏó·ÃÎÊÐÒé (SOAP) µÄ Web ·þÎñÆ÷¹«¿ªµÄÔ¶³Ì·½·¨¡£
Ä¿µÄ£ºÌṩһÖÖ¼òµ¥µÄ·½·¨Ê¹ÓúÍÀûÓà SOAP£¬¶ø²»Ðè¾ßÓÐ SOAP ʵÏÖµÄרҵ֪ʶ¡£
²½Ö裺
1.ÏÂÔØWebservice.htc,Ðí¶àÍøÉϵÄÎÄÕ½éÉܸÃÎļþ¿ÉÒÔÔÚ΢ÈíµÄÍøÕ¾ÉÏÕÒµ½£¬µ«ÎÒ°´ÕÕµØÖ·µã½øÈ¥Ê±£¬Ö»¿´µ½ÍøÒ³²»´æÔÚµÄÌáʾ
2.´´½¨WebServiceÎļþ¼ÙÉèΪMathService.asmx£¬ÆäÌṩAddºÍSubtractÁ½¸ö·þÎñº¯Êý
3.´´½¨µ÷ÓõÄÍøÒ³ÎļþSample.htm(ÎļþÄÚÈÝÔÚÏÂÃæÏêϸ·ÖÎö)
4.½«Webservice.htc¸´ÖƵ½Sample.htmͬһĿ¼ÏÂ
5.ͨ¹ýä¯ÀÀÆ÷£¬ä¯ÀÀ¸ÃÍøÒ³
ÏÂÃæ·ÖÎöSample.htmµÄÄÚÈÝ£¨È¡×ÔMsdn£©
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<LINK REL="stylesheet" HREF="/workshop/samples/samples.css" TYPE="text/css">
<SCRIPT language="JavaScript">
var iCallID;
var callObj;
function init()
{
// ¶¨Î»WebService·þÎñλÖ㬲¢ÇÒΪ¸Ã·þÎñÖÆ¶¨Ò»¸öÃû×Ö
// ͬһServiceURl¿ÉÒÔÖ¸¶¨¶à¸öÃû×Ö,ServiceΪHTMÎļþÖеÄHTML TAG,¿ÉÒÔʹÓÃHTMLÖж¨ÒåµÄÈκαê¼Ç
service.useService("..\\..\\MathService.asmx?WSDL","MyMath");
// ½ûÓÃAdd°´Å¥.
doAddButton.disabled = true;
service.onserviceavailable = enableButton();
}
function enableButton(){
doAddButton.disabled = false;
}
function doAdd(x, y){
// ͬ²½µ÷Óà // ´´½¨Ò»¸ö the SOAPHeader object
var headObj = new Object();
// ´´½¨ the call object
callObj = service.createCallOptions();
callObj.async = false;
callObj.params = new Array();
callObj.params.a = x;
callObj.params.b = y;
callObj.funcName = "Add";
callObj.SOAPHeader = new Array();
callObj.SOAPHeader[0] = headObj;
oSPAN.innerText = x + " + " + y + " = ";
// ʹÓûص÷º¯Êý"mathResults"µ÷ÓÃ
iCallID = service.MyMath.callService(mathResults, callObj);
mathResults(iCallID);
}
function doSubtraction(y, x){
// Òì²½µ÷Óã¬ÕâÊÇϵͳĬÈϵĵ÷Ó÷½Ê½(the default)
oSPAN.innerText = y + " - " + x + " = ";
// µ÷ÓÃSubtract
// ʹÓûص÷º¯Êý"mathResults"µ÷ÓÃ
iCallID = service.MyMath.callService(mathResults, "Subtract", y, x);
}
functio
Ïà¹ØÎĵµ£º
ÔÎÄÁ´½Ó£ºJavaScript: Its Not Just for Browsers Any More
Node.jsÊÇÒ»Ì×ÓÃÀ´±àд¸ßÐÔÄÜÍøÂç·þÎñÆ÷µÄJavaScript¹¤¾ß°ü£¬Ò»ÏµÁеı仯ÓÉ´Ë¿ªÊ¼¡£
Ò²ÐíÄ㻹²»ÖªµÀ£¬JavaScriptÏÖÔÚÒѾ³ÉÁËÒ»Ãſɱàд³öЧÂʼ«¸ßµÄ¡¢¿ÉÓÃÓÚ¿ª·¢²úÆ·¼¶web·þÎñÆ÷µÄ³öÉ«ÓïÑÔ¡£Æð³õÎÒÒ²²»ÏàÐÅ£¬µ«2009 ÄêÆô¶¯µÄÁ½¸öÏîÄ¿ÈÃÕâ³ÉΪ¿ÉÄÜ£ºCommonJSº ......
ת×Ô£ºhttp://news.csdn.net/a/20100217/217053.html
JavaScript ¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±» Web ¿ª·¢Éè¼ÆÊ¦ÌùÉÏØ¬ÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇ DOM API£¬Õâ¸ö±»´óÁ¿µÄ¿ª·¢ÓëÉè¼ÆÊ¦ËæÊÖÄéÀ´ÔöÇ¿ËûÃÇµÄ Web ǰ¶ËµÄ½Å±¾ÓïÑÔ£¬Èç½ñÔ½À´Ô½±»ÖØÊÓ£¬ËäÔòÈç´Ë£¬JavaScript ÈÔȻӵÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔ J ......
<script type="text/javas
cript">
var docEle = function() {
return document.getElementById(arguments[0]) || false;
}
function openNewDiv(_id){
var m = "mask";
if (docEle(_id)) document.body.removeChild(docEle(_i ......
<script>
/*
ÓÃ;£ºÐ£ÑéipµØÖ·µÄ¸ñʽ
ÊäÈ룺strIP£ºipµØÖ·
·µ»Ø£ºÈç¹ûͨ¹ýÑéÖ¤·µ»Øtrue,·ñÔò·µ»Øfalse£»
*/
function isIP(strIP) {
if (isNull(strIP)) return false;
var re=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g //Æ¥ÅäIPµØÖ·µÄÕýÔò±í´ïʽ
if(re.test(strIP))
{
if( RegExp.$1 <256 &am ......
ÔÚ JS(JavaScript) ²Ù×÷cookies±È½Ï¸´ÔÓ£¬ÔÚ ASP ÀïÃæÎÒÃÇÖ»ÐèÒªÖªµÀ cookie µÄÃû³Æ¡¢cookie µÄÖµ¾ÍÐÐÁË£¬¶ø JS ÀïÃæ£¬ÎÒÃÇÃæ¶ÔµÄÊÇ cookie µÄ×Ö·û´®£¬Äã×Ô¼º±àдÕâ¸ö×Ö·û´®Ð´Èë¿Í»§¶Ë£¬È»ºó×Ô¼º½âÎöÕâ¸ö×Ö·û´®¡£
¡¡¡¡Ò»¡¢´Óд cookie ˵Æð¡£
var the_date = new Date("December 31, 2020");
var expiresDate ......