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

javascriptѧϰÐĵÃ(2)

ÄÚ²¿Êý×é
ÔÚJavaÖÐΪÁË·½±ãÄÚ²¿¶ÔÏóµÄ²Ù×÷,¿ÉÒÔʹÓô°Ìå(Forms)¡¢¿ò¼Ü(Frames)¡¢ÔªËØ(element)¡¢Á´½Ó(links)ºÍê(Anchors)Êý×éʵÏÖ¶ÔÏóµÄ·ÃÎÊ¡£
¡¡anchors[]:ʹÓá¶A name=“anchorName“¡·±êʶÀ´½¨Á¢ÃªµÄÁ´½Ó¡£
¡¡links[]: ʹÓÃ<A href=”URL”>À´¶¨ÒåÒ»¸öÔ½Îı¾Á´½ÓÏî¡£
¡¡Forms[]: ÔÚ³ÌÐòÖÐʹÓöരÌåʱ,½¨Á¢¸ÃÊý×é¡£
¡¡Elements[]:ÔÚÒ»¸ö´°¿ÚÖÐʹÓôӸöÔªËØʱ,½¨Á¢¸ÃÊý×é¡£
¡¡Frames[]:½¨Á¢¿ò¼Üʱ,ʹÓøÃÊý×é
¡¡anchors[]ÓÃÓÚ´°ÌåµÄ·ÃÎÊ(ËüÊÇͨ¹ý¡¶form name=“form1”¡·ËùÖ¸¶¨µÄ),link[]ÓÃÓÚ±»Á´½Óµ½µÄêµãµÄ·ÃÎÊ(ËüÊÇͨ¹ý¡¶a href=URL¡·ËùÖ¸¶¨µÄ)¡£Forms[]·´Ó³´°ÌåµÄÊôÐÔ,¶øanchors[]·´Ó³WebÒ³ÃæÖеÄÁ´½ÓÊôÐÔ¡£
ÓйØêÊý×éµÄÎĵµ£º
<HTML>
<HEAD>
<BODY>
<A NAME=”MyAnchorsName1”> ¶¨ÒåµÚÒ»¸öêÃû
HTML Code
<A NAME=”MyAnchorsName2”> ¶¨ÒåµÚ¶þ¸öêÃû
HTML Code
<A HREF=”#MyAnchorsName1”>½¨Á¢ÃªµÄÁ´½Ó
<A HREF=”#MyAnchorsName2?gt; ½¨Á¢ÃªµÄÁ´½Ó  Ô¤¶¨µãµÄλÖÃ
….
¸ÃÎĵµ¶Î½¨Á¢ÁËÁ½ÃæȫêµÄÁ´½Ó,¿Éͨ¹ýAnchors[]·ÃÎÊÕâЩê¡£document.Anchors[0]·´Ó³µÚÒ»¸öê,¶ødocument.Anchors[1]·´Ó³µÚ¶þ¸öêµÄÓйØÐÅÏ¢¡£
£³¡¢Îĵµ¶ÔÏóµÄ»ù±¾ÔªËØ
£¨£±£©´°ÌåÊôÐÔ£º
¡¡¡¡´°ÌåÊôÐÔÊÇÓëHTMLÎĵµÖÐ<Form>...</Form>Ïà¶ÔÓ¦µÄÒ»×é¶ÔÏóÔÚHTMLÎĵµËù´´½¨µÄ´°ÌåÊý£¬ÓÉlengthÖ¸¶¨¡£Í¨¹ýdocument.forms.length·´Ó³¸ÃÎĵµÖÐËù´´½¨µÄ´°ÌåÊýÄ¿¡£
£¨£²£©ÃªÊôÐÔ£ºanchors
¡¡¡¡¸ÃÊôÐÔÖУ¬°üº¬ÁËHTMLÎĵµµÄËùÓÐ<A> </A>±ê¼ÇΪName=...µÄÓï¾ä±êʶ¡£ËùÓГꔵÄÊýÄ¿±£´æÔÚdocument.anchors.lengthÖС£
£¨£³£©Á´½ÓÊôÐÔ£ºlinks
¡¡¡¡Á´½ÓÊôÐÔÊÇÖ¸ÔÚÎĵµÖÐ<A>...</A>µÄÓÉHref=...Ö¸¶¨µÄÊýÄ¿£¬ÆäÁ´½ÓÊýÄ¿±£´æÔÚdocument.links.lengthÖС£
Èý¡¢·¶Àý
Àý1:ÏÂÃæÎÒÃÇͨ¹ýÒ»¸öÀý×ÓÀ´ËµÃ÷Îĵµ¶ÔÏóµÄ×ÛºÏÓ¦Óá£Êä³ö½á¹û¼ûͼ6-2Ëùʾ¡£
Test6_2.htm
<html>
<head>
</HEAD>
<BOdy>
<Form Name="mytable">
ÇëÊäÈëÊý¾Ý£º
<Input Type="text" Name="text1" Value="">
</Form>
<A name="Link1" href="test31.htm">Á´½Óµ½µÚÒ»¸öÎı¾</a><br>
<A name="Link2" href="test32.htm">Á´½Óµ½µÚ¶þ¸öÎı¾


Ïà¹ØÎĵµ£º

[·­Òë]High Performance JavaScript(033)

Summary  ×ܽá
    When web pages or applications begin to feel slow, analyzing assets as they come over the wire and profiling scripts while they are running allows you to focus your optimization efforts where they are needed most.
    µ±ÍøÒ³»òÓ¦ÓóÌÐò±äÂýʱ£¬·ÖÎ ......

javascript prototype½éÉܵÄÎÄÕÂ

JavaScriptÊÇ»ùÓÚ¶ÔÏóµÄ£¬ÈκÎÔªËض¼¿ÉÒÔ¿´³É¶ÔÏó¡£È»¶ø£¬ÀàÐͺͶÔÏóÊDz»Í¬µÄ¡£±¾ÎÄÖУ¬ÎÒÃdzýÁËÌÖÂÛÀàÐͺͶÔÏóµÄһЩÌصãÖ®Í⣬¸üÖØÒªµÄÊÇÑо¿ÈçºÎд³öºÃµÄ²¢ÇÒÀûÓÚÖØÓõÄÀàÐÍ¡£±Ï¾¹£¬JavaScriptÕâÖÖÁ÷ÐеĽű¾ÓïÑÔÈç¹ûÄܹ»½øÐÐÁ¼ºÃµÄ·â×°£¬²¢ÐγÉÒ»¸öÅÓ´óµÄÀàÐͿ⣬¶ÔÓÚÖØÓÃÊǷdz£ÓÐÒâÒåµÄ¡£
ÍøÉ϶ÔÓÚprototypeµÄÎÄÕ弆 ......

javascript trim·½·¨

ÔÚjavascriptÖеÄstring¶ÔÏóûÓÐtrim·½·¨£¬ËùÒÔtrim¹¦ÄÜÐèÒª×Ô¼ºÊµÏÖ£º
´úÂëÈçÏ£º
Java´úÂë
﹤scriptlanguage=”javascript”﹥   
/**  
*ɾ³ý×óÓÒÁ½¶ËµÄ¿Õ¸ñ  
*/  
String.prototype.trim=function(){      
  &nbs ......

JavaScript µ÷ÓÃ±íµ¥ÖØÖ÷½·¨


1 history.go(0)  
2 location.reload() £¨Ò³Ãæ½øÐÐˢУ¬µ«ÎªdisabledµÄÔªËصÄÖµ²»»á±»Çå¿Õ£©
3 location=location 
4 location.assign(location) 
5 location.replace(location) 
6 from..reset()  (Ò³Ãæ²»½øÐÐˢУ¬Ä£Äâµ¥»÷¶ÔËùµ÷ÓÃ±íµ¥ÖØÖð´Å¥µÄµ¥»÷)
......

107ÌõJavascriptµÄ³£ÓÃÓï¾ä


1. document.write( " "); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document- >html- >(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window- >(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËصÄÃû³ÆºÍÖµ:document.getElementById( "±íµ¥ÖÐÔªËصÄID號 ").name(»òvalue)
6.Ò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ