Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaScript½øÐÐGETºÍPOSTÇëÇó

JavaScript½øÐÐGETºÍPOSTÇëÇó
WebÉÏ×î³£¼ûµÄÇëÇó¾ÍÊÇGETÇëÇó.ÿ´ÎÔÚä¯ÀÀÆ÷ÖÐÊäÈëURL²¢´ò¿ªÒ²Ã×ÄÉÊÐ,¾ÍÊÇÔÚÏò·þÎñÆ÷·¢ËÍÒ»¸öGETÇëÇó.
GETÇëÇó£º
GETÇëÇóµÄ²ÎÊýʹÓÃÎʺÅ×·¼Óµ½URLµÄ½áβ,ºóÃ×ÄɸøÕâÓÃ&ºÃÁ¬½ÓÆðÀ´µÄÃû³Æ/Öµ.ÀýÈç:
http://www.somewhere.com/page.php?name1=value1&name2=value2&name3=value3
ÿ¸öÃû³ÆºÍÖµ¶¼ÊÇÔÚ±àÂëºó²ÅÄÜÓÃÔÚURLÖУ¨ÔÚjavaScriptÖпÉÒÔÓÃencodeURIComponent()½øÐбàÂ룩¡£URL×î´ó³¤¶ÈΪ2048×Ö·û£¨2KB£©¡£ÎʺúóÃ×ÄɵÄÄÚÈݳÉΪ²éѯ×Ö·û´®£¬ÕâЩ²ÎÊý¿ÉÒÔÔÚ·þÎñÆ÷¶ËµÄÒ³ÃæÖжÁÈ¡¡£
ÒªÓÃXMLHTTPÇëÇó¶ÔÏó·¢ËÍÒ»¸öGETÇëÇó¡£Ö»Ð轫URL£¨°üº¬ËùÓеIJÎÊý£©´«Èëopen()·½·¨¡£Í¬Ê±µÚÒ»¸ö²ÎÊý¶ÎÉèΪ”get”:
oRequest.open(“get”, “http://www.somewhere.com/page.php?name=value”, false);
ÒòΪ²ÎÊý±ØÐëÖð¼Òµ½URLµÄĩ⣬ËùÒÔ×îºÃÓÃÒ»¸öº¯ÊýÀ´´¦Àí´Ëϸ½Ú£º
Function addURLParam(sURL, sParamName, sParamName){
         sURL += (sURL.indexOf(“?”) == -1 ? “?” : “&”);
         sURL += encodeURIComponent(sParamName) + “=” + encodeURIComponent(sParamName);
         return sURL;
}
Èý¸ö²ÎÊý·Ö±ðΪ£ºÒªÌí¼ÓµÄURL£¬²ÎÊýÃû³ÆºÍ²ÎÊýÖµ¡£
POSTÇëÇó£º
POSTÇëÇóͨ³£ÓÃÓÚÌá½»Êý¾Ý£¬±ÈGETÇëÇó¿ÉÒÔ·¢Ë͸ü¶àµÄÊý¾Ý£¨´óÔ¼2GB£©¡£
¹¹ÔìPOSTµÄÇëÇó²ÎÊýµÄº¯Êý£º
Function addPostParam(sParams, sParamName, sParamValue){
         if(sParams.length>0){sParams += “&”};
         return sParams +encodeURIComponent(sParamName) + “=”
          + encodeURIComponent(sParamName);
}
½ÓÏÂÀ´ÎªÁËÄÜʹPOSTÇëÇóµÄ·þÎñÆ÷¶ËÒ³ÃæÕýÈ·µÄ½âÊÍÓд˺¯Êý¹¹ÔìµÄ²ÎÊý×Ö·û´®£¬ÐèÒª½«POSTÇëÇóÊײ¿“Content-Type”ÉèÖÃΪ“application/x-www-urlencoded”£¬ËùÒÔÐèҪʹÓÃsetRequestHeader()·½·¨ÉèÖÃÕâ¸öÊײ¿£º
var sParams = ‘ ‘;
sParams = addPostParam();
oRequest.open(&ldq


Ïà¹ØÎĵµ£º

JavaScript_»ùÓÚJSµÄ½ø¶ÈÌõ

¿ª·¢Ê±£¬ÐèÒªÓõ½µÄJavaScript½ø¶ÈÌõ~~~
<style type="text/css">
#out {
width:200px;
height:16px !important;
border:1px solid #5858D1;
text-align:center;
position:relative;
font-size:12px;
_height:18px;
}
#out, #out * {
padding:0;
margin:0;
}
#num {
height:16px;
line-h ......

¡¶Îò͸javascript¡·Ñ§Ï°±Ê¼Ç£º¾Å¡¢Ô­Ðͱ϶

ÒýÑÔ
 
      prototypeÔ´×Ô·¨ÓÈí¼þ½çµÄ±ê×¼·­ÒëΪ“Ô­ÐÍ”£¬´ú±íÊÂÎïµÄ³õʼÐÎ̬£¬Ò²º¬ÓÐÄ£ÐͺÍÑù°åµÄÒâÒå¡£
 
prototypeÊôÐÔ
 
JavaScriptµÄËùÓÐfunctionÀàÐ͵ĶÔÏó¶¼ÓÐÒ»¸öprototypeÊôÐÔ¡£Õâ¸öprototypeÊôÐÔ±¾ÉíÓÖÊÇÒ»¸ö object ÀàÐ͵ĶÔÏó£¬Òò´ËÎÒÃÇÒ²¿ÉÒÔ¸ ......

javascriptʵÏÖÏñjava¡¢c#Ö®ÀàµÄsleepÔÝÍ£µÄº¯Êý¹¦ÄÜ

ÎÒÃǶ¼ÖªµÀjava¡¢c#¡¢vbµÈÓïÑÔ¶¼ÓÐsleepÔÝÍ£µÄº¯Êý£¬¶øJavaScript½Å±¾Ã»ÓÐÀàËƵŦÄÜ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄʵÏֵķ½·¨£º
<mce:script type="text/javascript"><!--
function test()
{
var s="javascript--ÔÝÍ£º¯Êý";
setTimeout(
function(){
eval(sleep(test)); //Ö´ÐÐreturnÖ®ºóµÄ´úÂ룬Ҳ¾ÍÊÇ&ldq ......

JavaScript×îÈÃÈ˷ѽâµÄÊ®¼þÊÂ(

Ô­ÎĵØÖ·£ºhttp://developer.51cto.com/art/201002/185161.htm
JavaScriptÊÇÒ»Öֹ㷺ÓÃÓÚ¿Í»§¶ËWeb¿ª·¢µÄ½Å±¾ÓïÑÔ£¬Æä¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±»Web¿ª·¢Éè¼ÆʦÌùÉÏجÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇDOM API£¬Ò²Ôø¾­ÓÐÈËÈÏΪJavaScriptÓï·¨ÖÐÓкܶàÏÝÚ壬ͬʱÆäÒ²ÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔJavaÃüÃû£¬µ«²¢ ......

ÔÚjavascriptÖлñÈ¡ÖÐÓ¢ÎÄ×Ö·û³¤¶ÈµÄÎÊÌâ


ÔÚjavascriptÖлñÈ¡ÖÐÓ¢ÎÄ×Ö·û³¤¶ÈµÄÎÊÌâ
var i="Öйúa";
Ò»°ãÇé¿öÏ£¬ÎÒÃÇÓÃi.length»áµÃµ½½á¹û3
µ«ÓÐʱºòÎÒÃÇÐèÒª5£¬ÏÂÃæµÄС´úÂë¿ÉÒÔ½â¾öÎÊÌâ
Java´úÂë
 1. <script>     
 2.  alert (fucCheckLength("Öйúaaaa"));     
& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ