Javascriptµ÷ÓÃWebserviceµÄ¶àÖÖ·½·¨
ͨ¹ýxmlhttp+webservice(Ôʼ·½·¨)
ÔÎĵØÖ·:http://netboy.cnblogs.com/archive/2006/02/18/333260.html
view plaincopy to clipboardprint?
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[webservice(namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service ()
{
//uncomment the following line if using designed components
//InitializeComponent();
}
[webmethod]
public string SayHelloTo(string Name)
{
return "Hello "+Name;
}
}
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[webservice(namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service ()
{
//uncomment the following line if using designed components
//InitializeComponent();
}
[webmethod]
public string SayHelloTo(string Name)
{
return "Hello "+Name;
}
}
»¹ÊÇË×Á˵㡣:)
2. jsµ÷ÓÃwebservice+xmlhttpµÄʵÏÖ²¿·Ö¡£
view plaincopy to clipboardprint?
<html>
<title>Call webservice with javascript and xmlhttp.</title>
<body>
<mce:script language="javascript"&
Ïà¹ØÎĵµ£º
Ò»¸ö¹«ÓÃÀࣺflash.external.ExternalInterface£»
¸ÃÀàÓÐÁ½¸öÏà¹Ø·½·¨£º
1¡¢µ÷ÓÃjavascriptº¯Êý£»
ExternalInterface.call(´jsº¯ÊýÃû´[,ÒÔ¶ººÅ¸ô¿ªµÄ¶à¸ö²ÎÊý]);
ÆäÖÐjsº¯ÊýÃûΪÔÚjavascriptÖÐÉêÃ÷µÄº¯ÊýÃû³Æ£¬
´«µÝµÄ²ÎÊý¿ÉÒÔÊÇasÖÐÈκÎÀàÐ͵ÄÊý¾Ý£¬ÕâЩ²ÎÊý½«±»×Ô¶¯×ª»»³Éjs±äÁ¿£»
2¡¢×¢²ájsÖпÉÓÃµÄ»Ø ......
ÓÐÁËÇ°ÃæµÄһƪÎÄÕ¡¶ÔÚ Wordpress ²å¼þÖÐʹÓÃÑùʽ±í¡·£¬Ôò±¾½Ú¡¶ÔÚ WP ²å¼þÖÐʹÓà Javascript¡·¾ÍºÃÃèÊö£¬Ò²ÈÝÒ×Àí½âµÄ¶àÁË¡£
1£¬²å¼þµÄÎļþ¼Ð½á¹¹ÓëǰÎÄÏàͬ¡£²å¼þÍê³ÉµÄ¹¦ÄÜǰÎÄÒѾÊö¼°£¬±¾½Ú½«¼ÓÒ»¸ö¹¦ÄÜ£¬µ±ÔÚÎÄ×ÖÉϵã»÷ʱ£¬µ¯³öÒ»¸ö´°¿Ú¡£±¾½ÚʾÀýÒ²ÔÚǰÎÄʾÀýµÄ»ù´¡ÉÏ¿ª·¢¡ ......
ÓÐʱºò½øÐÐajax½»»¥µÄʱºò£¬·µ»ØµÄÊý¾Ý¿ÉÒÔ×Ô¼ºÌí¼Ó·Ö¸ô·û£¬±ÈÈç^^^£¬È»ºó¶ÔÕâЩ·Ö¸ô·û½øÐнâÎö£¬·Ö½âΪһ¸öÊý×é¡£
function fill(v) {
if (v == undefined)return false;
var result = v.split("^^^");
$("#cnPatent").val(result[0]);
$("#cnPText").val(result[1]); ......
jsÈçºÎʵÏÖÔÚÒ³ÃæÍêÈ«¼ÓÔØºóÖ´ÐÐjavascriptº¯Êý»ò/´úÂëÄØ?
¿ÉÒÔÊÇÒÔϼ¸ÖÖ
<body onload="function name()" > </body >
<script >window.onload=function name </script >
<script language="javascript" for="window" event="onload" >function name(); </script >
µ ......