js»ñÈ¡HTML DOM½ÚµãÔªËØ·½·¨×ܽá
ÔÚWebÓ¦ÓóÌÐòÌرðÊÇWeb2.0³ÌÐò¿ª·¢ÖУ¬¾³£Òª»ñÈ¡Ò³ÃæÖÐij¸öÔªËØ£¬È»ºó¸üиÃÔªËصÄÑùʽ¡¢ÄÚÈݵȡ£ÈçºÎ»ñÈ¡Òª¸üеÄÔªËØ£¬ÊÇÊ×ÏÈÒª½â¾öµÄÎÊÌâ¡£ÁîÈËÐÀοµÄÊÇ£¬Ê¹ÓÃJavaScript»ñÈ¡½ÚµãµÄ·½·¨ÓкܶàÖÖ£¬ÕâÀï¼òµ¥×öÒ»ÏÂ×ܽᣨÒÔÏ·½·¨ÔÚIE7ºÍFirefox2.0.0.11²âÊÔͨ¹ý£©¡£
1. ͨ¹ý¶¥²ãdocument½Úµã»ñÈ¡£º
(1)document.getElementById(elementId) £º¸Ã·½·¨Í¨¹ý½ÚµãµÄID£¬¿ÉÒÔ׼ȷ»ñµÃÐèÒªµÄÔªËØ£¬ÊDZȽϼòµ¥¿ì½ÝµÄ·½·¨¡£Èç¹ûÒ³ÃæÉϺ¬Óжà¸öÏàͬidµÄ½Úµã£¬ÄÇôֻ·µ»ØµÚÒ»¸ö½Úµã¡£
Èç½ñ£¬ÒѾ³öÏÖÁËÈçprototype¡¢MootoolsµÈ¶à¸öJavaScript¿â£¬ËüÃÇÌṩÁ˸ü¼ò±ãµÄ·½·¨£º$(id)£¬²ÎÊýÈÔÈ»ÊǽڵãµÄid¡£Õâ¸ö·½·¨¿ÉÒÔ¿´×÷ÊÇdocument.getElementById()µÄÁíÍâÒ»ÖÖд·¨£¬²»¹ý$()µÄ¹¦ÄܸüΪǿ´ó£¬¾ßÌåÓ÷¨¿ÉÒԲο¼ËüÃǸ÷×ÔµÄAPIÎĵµ¡£
(2)document.getElementsByName(elementName) £º¸Ã·½·¨ÊÇͨ¹ý½ÚµãµÄname»ñÈ¡½Úµã£¬´ÓÃû×Ö¿ÉÒÔ¿´³ö£¬Õâ¸ö·½·¨·µ»ØµÄ²»ÊÇÒ»¸ö½ÚµãÔªËØ£¬¶øÊǾßÓÐͬÑùÃû³ÆµÄ½ÚµãÊý×顣Ȼºó£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÒª»ñÈ¡½ÚµãµÄij¸öÊôÐÔÀ´Ñ»·ÅжÏÊÇ·ñΪÐèÒªµÄ½Úµã¡£
ÀýÈ磺ÔÚHTMLÖÐcheckboxºÍradio¶¼ÊÇͨ¹ýÏàͬµÄnameÊôÐÔÖµ£¬À´±êʶһ¸ö×éÄÚµÄÔªËØ¡£Èç¹ûÎÒÃÇÏÖÔÚÒª»ñÈ¡±»Ñ¡ÖеÄÔªËØ£¬Ê×ÏÈ»ñÈ¡¸Ã×éÔªËØ£¬È»ºóÑ»·ÅжÏÊǽڵãµÄcheckedÊôÐÔÖµÊÇ·ñΪtrue¼´¿É¡£
(3)document.getElementsByTagName(tagName) £º¸Ã·½·¨ÊÇͨ¹ý½ÚµãµÄTag»ñÈ¡½Úµã£¬Í¬Ñù¸Ã·½·¨Ò²ÊÇ·µ»ØÒ»¸öÊý×飬ÀýÈ磺document.getElementsByTagName('A')½«»á·µ»ØÒ³ÃæÉÏËùÓг¬Á´½Ó½Úµã¡£
ÔÚ»ñÈ¡½Úµã֮ǰ£¬Ò»°ã¶¼ÊÇÖªµÀ½ÚµãµÄÀàÐ͵ģ¬ËùÒÔʹÓø÷½·¨±È½Ï¼òµ¥¡£µ«ÊÇȱµãÒ²ÊÇÏÔ¶øÒ×¼û£¬ÄǾÍÊÇ·µ»ØµÄÊý×é¿ÉÄÜÊ®·ÖÅÓ´ó£¬ÕâÑù¾Í»áÀ˷Ѻܶàʱ¼ä¡£ÄÇô£¬Õâ¸ö·½·¨ÊDz»ÊǾÍûÓÐÓô¦ÁËÄØ£¿µ±È»²»ÊÇ£¬Õâ¸ö·½·¨ºÍÉÏÃæµÄÁ½¸ö²»Í¬£¬Ëü²»ÊÇdocument½ÚµãµÄרÓз½·¨£¬»¹¿ÉÒÔÓ¦ÓÃÆäËûµÄ½Úµã£¬ÏÂÃ潫»áÌáµ½¡£
2¡¢Í¨¹ý¸¸½Úµã»ñÈ¡£º
(1)parentObj.firstChild £ºÈç¹û½ÚµãΪÒÑÖª½Úµã£¨parentObj£©µÄµÚÒ»¸ö×Ó½Úµã¾Í¿ÉÒÔʹÓÃÕâ¸ö·½·¨¡£Õâ¸öÊôÐÔÊÇ¿ÉÒԵݹéʹÓõģ¬Ò²¾ÍÊÇÖ§³Ö:
parentObj.firstChild.firstChild.firstChild...
µÄÐÎʽ£¬Èç´Ë¾Í¿ÉÒÔ»ñµÃ¸üÉî²ã´ÎµÄ½Úµã¡£
(2)parentObj.lastChild £ººÜÏÔÈ»£¬Õâ¸öÊôÐÔÊÇ»ñÈ¡ÒÑÖª½Úµã£¨parentObj£©µÄ×îºóÒ»¸ö×ӽڵ㡣ÓëfirstChildÒ»Ñù£¬ËüÒ²¿ÉÒԵݹéʹÓá£ÔÚʹÓÃÖУ¬Èç¹ûÎÒÃǰѶþÕß½áºÏÆðÀ´£¬ÄÇô½«»á´ïµ½¸ü¼ÓÁîÈËÐ˷ܵÄЧ¹û£¬¼´£ºparentObj.firstChild.lastChild.la
Ïà¹ØÎĵµ£º
HTML:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<META HTTP-EQUIV="expires" CONTENT="0">
PHP£º
header("Expires: Mon, 26 Jul 1997 ......
JSPÊÇÈÝÒ׳öÏÖÂÒÂëÎÊÌ⣬²»¹ýÄãֻҪעÒâÒÔϼ¸µã¾ÍÒ»¶¨Äܸ㶨 ¿É²Î¿¼http://www.historycreator.com/bbs/2009-10/19/033181872.html
1¡¢±£Ö¤ÄãµÄÎı¾±àÂëÓëÄãËùÆÚÍûµÄ±àÂëÏà·û£¨ÓÃд×Ö°å´ò¿ªÄãµÄÒ³ÃæÈ»ºóÎļþÁí´æΪ£¬ÔÚ±àÂëλÖÃÑ¡ÔñÄãÆÚÍûµÄÎı¾±àÂ룬GB2312¶ÔÓ¦ANSI£¬UTF8µ±È»¶ÔÓÚUTF8ÁË£©
2¡¢±£Ö¤´úÂëÀïÃæµÄÉùÃ÷±àÂëÓëÄ ......
_blank : ÔÚÒ»¸öеģ¬Ã»ÓÐÃüÃûµÄ´°¿ÚÖдò¿ªÖ¸¶¨Îĵµ
_self : ÔÚµ±Ç°´°¿ÚÖдò¿ªÎĵµ
_parent : ÔÚ¸¸´°¿ÚÖдò¿ªÎĵµ£¬µ±Ã»Óи¸´°¿Úʱ£¬_parentÓë_selfÊÇÒ»ÑùµÄ
_top £º ÔÚµ±Ç°´°¿ÚÖдò¿ªÎĵµ£¬²¢ÇÒ´ò¿ªµÄÎ ......
Ê×ÏÈÔÚlayoutÎļþ¼ÐϵÄxmlÖÐ ¼ÓÈëWebView¿Ø¼þ
<WebView
android:id="@+id/wv1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
ÔÙÔÚÖ÷ÎļþÖÐÊäÈëÈçÏ´úÂë
public class TestDemo extends Activity {
/** Called when the activity is first created. */ ......
=======<html:messages>============
Action ÖÐ :
ActionMessages message = new ActionMessages();
message.add(" ÏûÏ¢¾ä±ú ",new ActionMessage(" ×ÊÔ´ÎļþÖÐ Key Öµ ",String ÀàÐÍÃèÊöÐÅÏ¢ ));
this.addMessages(request,message);
......