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

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£ºÈç¹û½Úµ


Ïà¹ØÎĵµ£º

HTML INPUT±êÇ©

<OBJECT id=WebBrowser height=0 width=0
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT>
<INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=´ò¿ª name=Button1>
<INPUT onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=Áí´æΪ name=Butt ......

´´½¨×Ô¶¨ÒåHTML Helper

´Ë½Ì³ÌÏòÄãÑÝʾÈçºÎÔÚÄãµÄMVCÊÓͼÀï´´½¨×Ô¶¨ÒåHTML Helper¡£ÀûÓà HTML Helpers, ¿ÉÒÔ¼õÉÙ·¦Î¶µÄÊäÈëHTML±êÇ©¡£
Ôڽ̵̳ĵÚÒ»²¿·Ö£¬ÎÒÃèÊöÁËASP.NET MVC¿ò¼ÜÒÑÓеÄHTML Helper¡£È»ºó£¬ÎÒÃèÊöÁË´´½¨×Ô¶¨ÒåHTML HelperµÄÁ½¸ö·½·¨£ºÎÒ»á½âÊÍÈçºÎͨ¹ý´´½¨¾²Ì¬·½·¨ºÍÀ©Õ¹·½·¨À´´´½¨HTML Helper¡£
Àí½â HTML Helper
HTML Helper ......

W3C±ê×¼µÄHTML±êÇ© °´¹¦ÄÜÀà±ðÅÅÁÐ

W3C±ê×¼µÄHTML±êÇ©
°´¹¦ÄÜÀà±ðÅÅÁÐ
DTD£ºÖ¸Ê¾ÔÚÄÄÖÖ XHTML 1.0 DTD ÖÐÔÊÐí¸Ã±êÇ©¡£
S=Strict,ÑϸñÀàÐÍ, T=Transitional,¹ý¶ÉÀàÐÍ¡¾×îÆձ顿, F=Frameset,¿ò¼ÜÀàÐÍ.
±êÇ©³É¶Ô£¬xhtmlÊDZÈhtml¸üÑϸñ£¬ÀàËÆXML¸ñʽ
±êÇ©ÃèÊöDTD
<!DOCTYPE> 
¶¨ÒåÎĵµÀàÐÍ¡£
STF
<html>
¶¨Òå HTML Îĵµ¡£
STF
< ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ