Ajax
Ò».×ÊÔ´ÀàÍøÕ¾
1,¹úÄÚÍøÕ¾
1)AjaxÖйú(ÍƼö)
Ò»¸öרҵµÄajax¼¼ÊõÍøÕ¾,·ÖÀàÇåÎú,ÓдóÁ¿µÄµç×Ó°æ½Ì³Ì,ÒÔ¼°AJAXÔ´ÂëÏÂÔØ!
www.okajax.com
2)ajaxcn.org
ÀîçûÀÏʦµÄblog¡£Àîçû:¡¶ajaxʵս¡·ÒëÕß.
www.ajaxcn.org
-----------------------------------------
2,¹úÍâÍøÕ¾
1)¡¢AjaxµÄµ®Éú
Ajax:ANewApproachtoWebApplications
www.adaptivepath.com/publications/essays/archives/000385.php
2)¡¢AJAXMatters
www.ajaxmatters.com
¹ØÓÚAjax¼¼ÊõÒ»¸öÐÅÏ¢Á¿·Ç³£´óµÄÍøÕ¾£¬ÓеãÏñAjaxÊÀ½çÖеÄTSS¡£
3)¡¢AJAXPatterns
ÓëAJAXÉè¼ÆģʽÏà¹ØµÄ×ÊÔ´¡£
www.ajaxpatterns.org
www.softwareas.com/ajax-patterns
4)¡¢http://www.ajaxian.com
¶þ.ÈÈÃÅÎÄÕÂ
1.ʲôÊÇAJAX
www.okajax.com/info/net/20060510.html
2.ajax¼¼Êõ¼ò½é
www.okajax.com/info/basic/200604654.html
3.ajax.net
www.okajax.com/info/basic/200604556.html
www.okajax.com/info/tech/200605589.html
weblogs.asp.net/mschwarz/archive/2005/04/11/399893.aspx(Ó¢ÎÄ)
Èý.ajaxÏà¹ØÏÂÔØ£¨µç×ÓÊé½Ì³Ì/Ô´Â룩
1.Ajax»ù´¡½Ì³Ìµç×Ó°æ
www.okajax.com/info/bookdown/200604950.htm
2.¡¶AJAXÊµÕ ......
Figure A MaskedEdit À©Õ¹Æ÷ÊôÐÔ
ÊôÐÔ
ĬÈÏÖµ
˵Ã÷
AcceptAMPM
False
Ò»¸ö²¼¶ûÊôÐÔ£¬ÓÃÓÚָʾÊÇ·ñӦʹÓà AM/PM ·ûºÅ¡£
AcceptNegative
None
ָʾÊÇ·ñÔÊÐíʹÓøººÅ (-)¡£À´×Ô MaskedEditShowSymbol ö¾ÙµÄ¿ÉÓÃÖµ°üÀ¨£ºNone¡¢Left ºÍ Right¡£
AutoComplete
True
Ò»¸ö²¼¶ûÊôÐÔ£¬ÓÃÓÚָʾÊÇ·ñ±ØÐë×Ô¶¯ÌîдÓû§Î´Ö¸¶¨µÄ¿ÕÑÚÂë×Ö·û¡£
AutoCompleteValue
""
ָʾÔÚÆôÓà Autocomplete ʱҪʹÓõÄĬÈÏ×Ö·û¡£
Century
1900
ָʾµ±Äê·ÝµÄÈÕÆÚÑÚÂë½öÓÐÁ½Î»Êý×ÖʱҪʹÓõÄÊÀ¼Í¡£
ClearMaskOnLostFocus
True
Ò»¸ö²¼¶ûÊôÐÔ£¬ÓÃÓÚָʾµ±Îı¾¿òʧȥÊäÈë½¹µãʱÊÇ·ñɾ³ýÑÚÂë¡£
ClearTextOnInvalid
False
Ò»¸ö²¼¶ûÊôÐÔ£¬ÓÃÓÚָʾµ±Óû§ÊäÈëÎÞЧÎı¾Ê±ÊÇ·ñÇå³ýÎı¾¿ò¡£
ClipboardEnabled
True
Ò»¸ö²¼¶ûÊôÐÔ£¬ÓÃÓÚָʾÊÇ·ñÔÊÐíʹÓüôÌù°å½øÐи´ÖÆ/Õ³Ìù¡£
ClipboardText
Your browser security settings don't permit the automatic execution of paste operations£¨ä¯ÀÀÆ÷µÄ°²È«ÉèÖò»ÔÊÐí×Ô¶¯Ö´ÐÐÕ³Ìù²Ù×÷£©
ָʾÔÚÖ´ÐмôÌù°åÕ³Ìù²Ù×÷ʱҪʹÓõÄÌáʾÎı¾¡£
CultureName
""
»ñÈ¡²¢ÉèÖÃҪʹÓõÄÇøÓòÐÔÉèÖõÄÃû³Æ¡£
DisplayMoney
None
......
ͼ1.1 ʵÀýÔËÐÐЧ¹û
1.1.1 ¼¼ÊõÒªµã
¶¯Ì¬¼ÓÔØFAQµÄ¹ý³ÌÖ÷ÒªÊÇÀûÓÃXMLHttpRequest£¨ÒÔϼò³ÆXHR£©¶ÔÏóÓë·þÎñ¶ËͨÐÅ£¬¸ù¾ÝÓû§µ¥»÷µÄ¸ÐÐËȤÎÊÌ⶯̬½«ÄÚÈݼÓÔص½Ò³ÃæÖС£ÔÚ¾ßÌåʵÏÖʱ£¬ÓÐÁ½µãҪעÒâµÄÄÚÈÝ¡£
1£®¶Ôÿ¸öÎÊÌâ½øÐÐΨһ±êʶ
FAQÖ÷Òª°üº¬ÎÊÌâÓë½â´ðÁ½¸ö²¿·Ö£¬Óû§µ¥»÷Ò»¸öÎÊÌâʱ£¬·þÎñÆ÷±ØÐëÖªµÀÇëÇóµÄÊÇÄĸöÎÊÌâµÄ½â´ð£¬ËùÒÔ±ØÐë¶Ôÿ¸öÎÊÌâ½øÐÐΨһ±êʶ¡£±êʶµÄ·½·¨ºÜ¶à£¬ÔÚ±¾ÀýÖмòµ¥Ê¹ÓÃÊý×Ö½øÐбêʶ¡£Ã¿¸öÎÊÌâÔÚÒ³ÃæÉϱíÏÖΪ³¬Á´½Ó£¬µ¥»÷Á´½Ó½«´¥·¢onclickʼþ£¬µ÷ÓÃloadFAQº¯Êý£¬´«ÈëÎÊÌâ±êʶ£¬»ñÈ¡¶ÔÓ¦µÄ½â´ð¡£
µ¥»÷ºó²¢²»ÊÇÒªÕæÕýÁ´½Óµ½Ò»¸öеÄÒ³Ã棬ËùÒÔÔÚ<a>±êÇ©µÄonclickʼþÖÐreturn falseÈ¡ÏûÔÓÐÁ´½ÓµÄ¹¦ÄÜ¡£Ã¿¸ö´ð°¸·ÖÅäÒ»¸ödivÓÃÓÚÏÔʾ£¬Ã¿¸ödivµÄidÊôÐÔÃüÃû¹æÔòΪ£¬ÔÚ¶ÔÓ¦µÄÎÊÌâÊý×Ö±êʶǰͳһÔö¼Ó“faqDetail”¡£
2£®¶ÔÒѼÓÔصĽâ´ð²»Öظ´Ïò·þÎñÆ÷·¢³öÇëÇó
ÎÊÌâµÄ½â´ð¼ÓÔغ󣬽«ÏÔʾÔÚ¶ÔÓ¦ÎÊÌâÏ·½µÄdivÖС£µ±Óû§Ôٴε¥»÷ÎÊÌâʱ¸Ãdiv½«Òþ²ØÆðÀ´¡£Èç¹ûÓû§µÚÈý´Îµ¥»÷ÏàͬµÄÎÊÌ⣬ÓÉÓÚ½â´ðÒѼÓÔص½Ò³Ã棬ËùÒÔ²»ÐèÒªÔÙ´ÎÏò·þÎñÆ÷·¢ËÍÇëÇó£¬Ö»Ð轫Òþ²ØµÄdivÏÔʾ³öÀ´¼´¿É¡£
Òþ²ØºÍÏÔʾÖ÷Ҫͨ¹ýÉèÖÃdivÑùʽÖеÄdi ......
±¾ÊµÀýʹÓÃÃûΪfaqµÄÊý¾Ý¿â±í£¬°üº¬µÄÊý¾ÝÈçͼ1.2Ëùʾ¡£¾ßÌåµÄ´´½¨Êý¾Ý±íÓï¾äÈçÏ£º
CREATE TABLE 'faq' (
'id' int(11) NOT NULL auto_increment,
'faq' varchar(255) NOT NULL,
'detail' varchar(255) NOT NULL,
PRIMARY KEY ('id')
)
ͼ1.2 ±ífaq°üº¬µÄÊý¾Ý
Ö÷Òª°üÀ¨Á½¸öÎļþ£ºÓû§²Ù×÷½çÃæindex.jspºÍ·þÎñÆ÷¶ËÏìÓ¦Îļþread_faq.jsp¡£ ......
Ò³ÃæÖÐÏÔʾÁË3¸öÎÊÌ⣬·Ö±ð±àºÅΪ1¡¢2¡¢3¡£Ã¿¸öÎÊÌâ±íÏÖΪһ¸ö³¬Á´½Ó£¬µ¥»÷³¬Á´½Ó´¥·¢loadFAQº¯Êý¡£Ã¿¸öÎÊÌâÏÂÃæ°üº¬Ò»¸öÓÃÓÚÏÔʾ´ð°¸µÄdiv£¬idÊôÐÔÉèÖÃΪ“faqDetail+ÎÊÌâ±àºÅ”£¬Í¨¹ýstyle="display:none"ĬÈÏÉèÖÃΪÒþ²Ø¡£ÏêϸµÄº¯Êý˵Ã÷Çë²Î¿¼´úÂëÖеÄ×¢ÊÍ¡£
<%@ page contentType="text/plain; charset=UTF-8"%>
<%@ page language="java"%>
<%@ page import="java.sql.*,ajax.db.DBUtils"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<head>
<title>¶¯Ì¬¼ÓÔصÄFAQ</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<script type="text/javascript">
var xmlHttp; //ÓÃÓÚ±£´æXMLHttpRequest¶ÔÏóµÄÈ«¾Ö±äÁ¿
var currFaqId; //ÓÃÓÚ±£´æµ±Ç°ÏëÒª»ñÈ¡µÄFAQ±àºÅ
//ÓÃÓÚ´´½¨XMLHttpRequest¶ÔÏó
function createXmlHttp() {
//¸ù¾Ýwindow.XMLHttpRequest¶ÔÏóÊÇ·ñ´æÔÚʹÓò»Í¬µÄ´´½¨·½Ê½
if (window.XMLHttpRequest) {
& ......
·þÎñÆ÷¶ËÏìÓ¦Îļþread_faq.jsp
·þÎñÆ÷ÏìÓ¦Îļþ¸ù¾ÝÓû§´«ÈëµÄfaqId²ÎÊý£¬´ÓÊý¾Ý¿âÖвéÕÒ¶ÔÓ¦µÄFAQÏêϸÐÅÏ¢¡£ÏêϸÐÅÏ¢¿ÉÒÔΪ°üº¬HTML±ê¼ÇµÄÄÚÈÝ¡£²éѯÍê±Ïºó½«½á¹û·µ»Ø¡£
<%@ page contentType="text/plain; charset=UTF-8"%>
<%@ page language="java"%>
<%@ page import="java.sql.*,ajax.db.DBUtils"%>
<%
out.clear(); //Çå¿Õµ±Ç°µÄÊä³öÄÚÈÝ£¨¿Õ¸ñºÍ»»Ðзû£©
String faqIdStr = request.getParameter("faqId"); ......