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

¹ØÓÚstruts2ÖÐajax±êÇ©µÄÒ»µãѧϰ±Ê¼Ç

ÆäʵajaxµÄ¶«Î÷²»ÊǺÜÊìϤ£¬¶øÇÒ¶ÔÓÚjavascriptÕâÑùÁãËéµÄÓïÑÔʵÔÚÊǺܿ¹¾Ü¡£ÓÚÊǹýÈ¥Ò»Ö±¶¼ÌÓ±ÜËü£¬ÆÈÓÚÏîÄ¿µÄѹÁ¦£¬²»µÃÒÑΩÓÐÓ²ÅöÓ²ÁË¡£ÎªÁË¿ìËÙÉÏÊÖ£¬Ö®Ç°×öÁ˼¸¸öСʵÑ飬´úÂëʵÔÚÌ«¶àÁË¡£ÐÒºÃstruts2ÌṩÁËһЩajaxµÄ¼òÒ×ʵÏÖ¡£
¸úÍøÉÏËùÓеĽ̳ÌÒ»Ñù£¬ÏÈ´Ó×î¼òµ¥µÄ¿ªÊ¼°É~
ÔÚÍ·½áµã¼ÓÉÏ<s:head theme="ajax"/>
È»ºó
<s:url id="requesturl" value="/get.action"></s:url>
<s:div id="information" theme="ajax"></s:div>
<s:a targets="information" theme="ajax" href="%{requesturl}" mce_href="%{requesturl}">»ñÈ¡ÐÅÏ¢</s:a>

·þÎñÆ÷¶ËµÄ´úÂëÎҾͲ»Ð´ÁË£¬´óͬСÒì¡£·µ»ØµÄ¿ÉÒÔÊÇÈκζ«Î÷£¬¸÷ÖÖ±íµ¥¡¢±í¸ñ¡¢Í¼Ê²Ã´µÄ£¬¾ßÌåÒª¿´ÄãÇëÇóµÄÊÇʲô¡£·µ»ØµÄ×ÊÔ´»áÖ±½ÓÏÔʾÔÚinformationµÄdivÖС£ÕâÀïÓиöСÎÊÌâҪעÒ⣬requesturlÖеÄvalueÖµ±ØÐëÊÇ/*.actionµÄÐÎʽ£¬¶ø²»ÄÜÊÇstruts.xmlÖеĶÔÓ¦µÄactionÃû³Æ¡£
¹ØÓÚÆäËûµÄÊôÐԾͲ»ÊµÑéÁË¡£
½ÓÏÂÀ´¼ÓÉÏÒ»µãjavascriptµÄ²Ù×÷£¬ÓÃÎı¾°´Å¥²Ù×÷·µ»Ø×ÊÔ´µÄÏÔʾºÍÒþ²Ø¡£
ÓÚÊǺÜ×ÔÈ»µÄÏëµ½ÕâÑùд£º
 <mce:script type="text/javascript"><!--
function hide(var i){
document.getElementById(i).style.display="none";
}
// --></mce:script>

È»ºó°ÑdivµÄidÖµ´«½øÈ¥£¬Íê³É£¡µ«ÊÇʧ°Ü¡£¡£Õâ¸öº¯ÊýÍêÈ«Ö´Ðв»ÁË¡£
Õâ¸öÎÊÌâÀ§ÈÅÁËÎҺܾã¬ÎÒ³¢ÊÔÁ˸÷ÖÖ¸÷ÑùµÄ·½·¨£¬×îºó·¢ÏÖ£¬javascriptµÄº¯Êý´«Öµ»úÖƸúƽʱдµÄC++ºÍJAVAÊÇÓÐÇø±ðµÄ¡£
ÔÚÉÏÃæµÄ´úÂëÖÐÖ»Òª¸Ä³Éfunction hide(i){...}¾Í¿ÉÒÔÖ´ÐÐÁË¡£
ΪʲôÕâÑùÄØ£¿
Ô­À´µÄ´úÂë´ó¸ÅÀàËÆÓÚjavaÖеÄString newcopy = prototype.clone();
¸Ãº¯ÊýÐÂÉêÇëÁËÒ»¸öµØÖ·²¢½ÓÊÜÁËÓë¸Ã²ÎÊýµÈÖµµÄÖµ£¬Òò´ËgetElementById()È¥ÁËÁíÍâÒ»¸öµØÖ·Ñ°Õҽڵ㣬¶øÄÇÀïûÓÐÎÒÃÇÒª²Ù×÷µÄ½Úµã£¬ÓÚÊǵ÷Óøú¯ÊýµÄʱºòû·´Ó¦¡£囧£¬ÖªÊ¶»¹µÃϵͳµÄѧ²ÅÐУ¬°ëͰˮ̫ΣÏÕÁË¡£
ÁíÍâ¹ØÓÚonclickÖеĺ¯Êýµ÷ÓÃÒ²ÓÐÒ»¸öÈÝÒ×ÊèºöµÄµØ·½£¬±ÈÈçÓиö<div id="a"></div>£¬´«ÖµµÄʱºòÓ¦¸ÃÊÇhide('a')¶ø²»ÊÇhide(a)£¬Ò²ÊǸöÀ§ÈÅÁËÎҺܾõĵͼ¶ÎÊÌâ¡£¡£


Ïà¹ØÎĵµ£º

Á÷ÐеÄAJAX¿ò¼Ü¶Ô±È£ºjQuery£¬Mootools£¬Dojo£¬Ext JS

À´Ô´£ºhttp://developer.51cto.com/art/200906/129502.htm
±¾ÎĽéÉÜÁËËÄÖÖÁ÷ÐеÄAJAX¿ò¼Ü£¬°üÀ¨¼ò½àµÄjQuery£¬ÃæÏò¶ÔÏóµÄ
Mootools£¬ÓµÓÐÇ¿´óÖ§³ÖµÄDojo£¬ÒÔ¼°×é¼þ»¯£¬RIA»¯µÄExt JS¡£
AJAX
ÊÇweb20
µÄ»ùʯ£¬ÏÖÔÚÍøÉÏÁ÷Ðм¸ÖÖ¿ªÔ´µÄ
AJAX¿ò¼Ü£¬±ÈÈ磺jQuery,Mootools,Dojo,Ext JSµÈµÈ£¬ÄÇôÎÒÃǵ½µ×ÔÚʲôÇé¿öϸÃÊ¹Ó ......

php+AJAX´«ËÍÖÐÎĻᵼÖÂÂÒÂëµÄÎÊÌâµÄ½â¾ö·½·¨

¹ØÓÚÔÚAJAXÖÐGET»ØµÄResponseTextÖÐÎÄÂÒÂëµÄ×î¼ò½â¾ö°ì·¨
//Èç¹û´«ËͲÎÊýÊÇÖ±½Ó¸³ÓèµÄ£¬¾Í»á²úÉúÂÒÂë!
´úÂëÈçÏÂ:
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+val); //Èç¹ûvalµÄ ......

ÔÚasp.net AJAX¿Í»§¶ËʹÓø´ÔÓÊý¾ÝÀàÐÍ·½·¨

<script language="javascript" type="text/javascript"> 
¡¡¡¡function doubleSalary()
¡¡¡¡{
¡¡¡¡var employee = new Object();
¡¡¡¡employee.FirstName = "X";
¡¡¡¡employee.LastName = "PP";
¡¡¡¡employee.Salary = 1000;
......

×î¼òµ¥µÄAjaxÀý×Ó

<input type="button" onclick="ajaxTest()" value="AJAX²âÊÔ">
<input type="button" onclick=" document.getElementById('weather').innerHTML='' " value="Òþ²Ø">
<mce:script type="text/javascript"><!--
// 1. ³õʼ»¯ ÇëÇó ¶ÔÏó
// Mozilla/Firefox 쵀
//var xmlhttp = ne ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ