Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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">Á´½Óµ½µÚ¶þ¸öÎı¾


Ïà¹ØÎĵµ£º

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷

JavascriptÎļþ¼°Îļþ¼Ð²Ù×÷
 
Ò»¡¢¹¦ÄÜʵÏÖºËÐÄ£ºFileSystemObject ¶ÔÏó
    ÒªÔÚjavascriptÖÐʵÏÖÎļþ²Ù×÷¹¦ÄÜ£¬Ö÷Òª¾ÍÊÇÒÀ¿¿FileSystemobject¶ÔÏó¡£
¶þ¡¢FileSystemObject±à³Ì
ʹÓÃFileSystemObject ¶ÔÏó½øÐбà³ÌºÜ¼òµ¥£¬Ò»°ãÒª¾­¹ýÈçϵIJ½Ö裺 ´´½¨FileSystemObject¶ÔÏó¡¢Ó¦ÓÃÏà¹Ø·½·¨¡¢· ......

Javascript ʹÓÃIDE¹¤¾ß½øÐе÷ÊÔ

1. Javascript Debug Toolkit½éÉÜ
JSDT(Javascript Debug Toolkit)ÊÇÒ»¸öÓÃÓÚjavascriptµ÷ÊÔµÄeclipse
²å¼þ£¬ÓÃÓÚµ÷ÊÔjavascript¡£JSDT¿ÉÒÔ¿çä¯ÀÀÆ÷µ÷ÊÔ£¬Ö§³ÖÔÚIE,Firefox,Safari,ChromeµÈÖ÷Á÷ä¯ÀÀÆ÷Öе÷ÊÔ
javascript¡£JSDTÖ§³ÖÉèÖöϵ㣬µ¥²½µ÷ÊԵȵ÷ÊÔ¹¤¾ßµÄ»ù±¾ÌØÐÔ¡£
2. ÈçºÎ°²×°
JSDTÊÇ»ùÓÚeclipse3.2+,jdk1.5+ ......

JavaScriptÖÐconfirm,alert,promptµÄÓ÷¨

±¾ÎļòÒª½éÉÜJavaScriptÖÐconfirm,alert,promptµÄÓ÷¨,Ï£Íû´ó¼Òѧϰ¹ý³ÌÖÐÄܵõ½Ò»Ð©Æô·¢¡£
window.confirm ²ÎÊý¾ÍÖ»ÓÐÒ»¸ö¡£ÏÔʾÌáʾ¿òµÄÐÅÏ¢¡£°´È·¶¨,·µ»Øtrue£»°´È¡Ïû·µ»Øfalse¡£
< SCRIPT> var bln = window.confirm("È·¶¨Âð?"); alert(bln) < /SCRIPT> window.alert²ÎÊý£¬Ö»ÓÐ ......

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.Ò ......

JavascriptÁ·Ï°ÊµÀý01:³Ë·¨¿Ú¾÷±íÓëɸѡËØÊý

<html>
<body>
<mce:script type="text/javascript"><!--
document.write("<table border=1px>");
for(i=1;i<=9;i++)
{document.write("<tr>");
for (j=1;j<=i;j++)
{document.write("<td class='table1'>"+i+"*"+j+"="+i*j+"&nbsp;&nbsp;& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ