[¶ÁÊé±Ê¼Ç][JavaScriptȨÍþÖ¸ÄÏ(µÚËÄ°æ)][DOM]
1.HTMLÎĵµÊ÷Ðαíʾ
2.Node[] Node.childNodes
//·µ»ØNode¶ÔÏóµÄËùÓÐ×Ö½Úµã
3.Node.firstChild / lastChild /nextSibling(ÏÂÒ»¸öÐֵܽڵã) / previousSibling (ÉÏÒ»¸öÐֵܽڵã) / parentNode
ÊôÐÔ
4.Node.appendChild() / removeChild() / replaceChild(oNewNode
,oOldNode
) / insertBefor(oNewNode,oChildNode
)
5.
³£ÓýڵãÀàÐÍ£º
6.ÉèÖÃÊôÐԵķ½·¨£º
string ELEMENT.getAttribute(sAttribute)
ELEMENT.setAttribute(sAttributeName,sAttributeValue)
ELEMENT.removeAttribute(sAttributeName)
7.ºËÐÄDOM API
8.//±éÀúÎĵµ½Úµã,¼Ç¼½ÚµãÊý
function countTags(node){
var numtags=0;
if(node.nodeType==1)
numtags++;
var children=node.childNodes;
for(var i=0;i<children.length;i++){
numtags+=countTags(children[i]);
}
return numtags;
}
9.ËÑË÷ÎĵµÖÐÌض¨ÔªËØ
collObjects
= object
.getElementsByTagName(
sTagName
)
oElement
= document
.getElementById(
sIDValue
)
10.´´½¨Îı¾ÔªËØ oTextNode
= document
.createTextNode(
[
sText
]
)
11.¸Ä±äÎı¾ÔªËصķ½·¨ÓÐ
TextNode.appendData(string data)
deleteData(nOffect,nCount) /*°ü»»nOffset*/
replaceData(nOffset,nCount,sString) /*nOffest¿ªÊ¼Î»ÖÃ,°üº¬nOffset;nCountÓ°ÏìÊý;sStringÌæ»»Îı¾*/
Ïà¹ØÎĵµ£º
³ö´¦£ºhttp://www.jcwcn.com/article/2005/1210/javascript_17476.html
<HTML>
<HEAD>
<title>WEBÒ³Ãæµ¼³öΪEXCELÎĵµµÄ·½·¨
</title>
</HEAD>
<body>
<BR>
<table id = "PrintA" width="100%" border="1" cell ......
±¾ÎÄת×Ô£ºhttp://www.felixwoo.com/archives/247
×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ÍÊÇÓÃ×îͨË×µÄÎÄ×Ö½Ò¿ªJavascript±Õ°üµÄÕæʵÃæÄ¿¡£
Ò»¡¢Ê²Ã´ÊDZհü£¿
“¹Ù·½”µÄ½âÊÍÊÇ£º±Õ°üÊ ......
O3D ÊÇÒ»¸ö¿ªÔ´µÄWeb API£¬Æä¿ÉÒÔ´´½¨Ï൱ţXµÄ»ùÓÚä¯ÀÀÆ÷µÄ¿É½»»¥Ê½µÄ3DÓ¦Óá£Õâ¸öAPIÔÚºÜÓпÉÄÜ»áÐγÉÒÔºóµÄWebÉϵÄ3DͼÐεıê×¼¡£ÏÂÃæÊÇÕâ¸öAPIµÄÖ÷Õ¾µã£º http://code.google.com/apis/o3d/ ¡£O3DÄ¿Ç°Ö§³ÖWindows, MacºÍLinuxÈýÖÖƽ̨¡£
ÏÂÃæÊÇһЩ¼òµ¥µØʹÓÃO3DµÄAPIµÄÈçºÎ´´½¨Ò»¸öÁ¢·½Ì壬¸üÏêϸµÄÄÚÈÝÇ ......
1.ÈçºÎÔÚjavascript·ÃÎÊC#±äÁ¿
·½·¨Ò»£ºÊ¹ÓÃ<%=%>
<input id="Button3" type="button" value="jsµ÷ÓÃc#±äÁ¿" onclick="return Button3_onclick()" />
function Button3_onclick()
{
alert('ÎÒµÄÃû×Ö£º'+ '<%=name %>'); ......
×îµÍÒ»Ö±ÔÚдJavaScript,¾Í±¾ÈËÓöµ½µÄÁ½¸öÎÊÌâÒÔ¼°½â¾ö·½·¨¸ø´ó¼Ò·ÖÏíÒ»ÏÂ.
1,µã»÷Ò»¸ö°´Å¥,´´½¨Ò»¶ÎHTML´úÂëºÍÏÖÓеÄһģһÑù,µ«ÊÇÀïÃæËùÓÐIDµÄ²ÎÊýºÍ·½·¨ÀïÃæµÄ²ÎÊýÒª¸Ä±ä,²ÎÊý¶¼ÊÇÈô¸É¸ö×Öĸ+Êý×Ö×é³É.д´½¨³öÀ´µÄHTML´úÂëƬ¶ÎÒªÀïÃæµÄ²ÎÊý±ä³É×Öĸ²»±ä,Êý×ÖÒª+1.
Èç,±ä֮ǰµÄ´úÂë,
<div id=”testdiv1&rd ......