javascript²Ù×÷dom ½¨Á¢ Ôö¼Ó ɾ³ý ¿Ë¡ ·ÃÎʽڵã
Ò»¡¢DOM»ù´¡
1.½Úµã(node)²ã´Î
Document££×²ãµÄ½Úµã£¬ËùÓеÄÆäËû½Úµã¶¼ÊǸ½ÊôÓÚËüµÄ¡£
DocumentType££DTDÒýÓã¨Ê¹ÓÃ<!DOCTYPE>Óï·¨£©µÄ¶ÔÏó±íÏÖÐÎʽ£¬Ëü²»ÄÜ°üº¬×ӽڵ㡣
DocumentFragment££¿ÉÒÔÏñDocumentÒ»ÑùÀ´±£´æÆäËû½Úµã¡£
Element££±íʾÆðʼ±êÇ©ºÍ½áÊø±êÇ©Ö®¼äµÄÄÚÈÝ£¬ÀýÈç<tag></tab>»òÕß<tag/>¡£ÕâÊÇΨһ¿ÉÒÔͬʱ°üº¬ÌØÐÔºÍ×Ó½ÚµãµÄ½ÚµãÀàÐÍ¡£
Attr££´ú±íÒ»¶ÔÌØÐÔÃûºÍÌØÐÔÖµ¡£Õâ¸ö½ÚµãÀàÐͲ»ÄÜ°üº¬×ӽڵ㡣
Text££´ú±íXMLÎĵµÖеÄÔÚÆðʼ±êÇ©ºÍ½áÊø±êÇ©Ö®¼ä£¬»òÕßCDataSectionÄÚ°üº¬µÄÆÕͨÎı¾¡£Õâ¸ö½ÚµãÀàÐͲ»ÄÜ°üº¬×ӽڵ㡣
CDataSection££<![CDATA[]]>µÄ¶ÔÏó±íÏÖÐÎʽ¡£Õâ¸ö½ÚµãÀàÐͽöÄÜ°üº¬Îı¾½ÚµãText×÷Ϊ×ӽڵ㡣
Entity££±íʾÔÚDTDÖеÄÒ»¸öʵÌ嶨Ò壬ÀýÈç<!ENTITY foo"foo">¡£Õâ¸ö½ÚµãÀàÐͲ»ÄÜ°üº¬×ӽڵ㡣
EntityReference££´ú±íÒ»¸öʵÌåÒýÓã¬ÀýÈç"¡£Õâ¸ö½ÚµãÀàÐͲ»ÄÜ°üº¬×ӽڵ㡣
ProcessingInstruction££´ú±íÒ»¸öPI¡£Õâ¸ö½ÚµãÀàÐͲ»ÄÜ°üº¬×ӽڵ㡣
Comment££´ú±íXML×¢ÊÍ¡£Õâ¸ö½Úµã²»ÄÜ°üº¬×ӽڵ㡣
Notation££´ú±íÔÚDTDÖж¨ÒåµÄ¼ÇºÅ¡£Õâ¸öºÜÉÙÓõ½¡£
Node½Ó¿Ú¶¨ÒåÁËËùÓнڵãÀàÐͶ¼°üº¬µÄÌØÐԺͷ½·¨¡£
ÌØÐÔ/·½·¨ ÀàÐÍ/·µ»ØÀàÐÍ ËµÃ÷
nodeName String ½ÚµãµÄÃû×Ö;¸ù¾Ý½ÚµãµÄÀàÐͶø¶¨Òå
nodeValue String ½ÚµãµÄÖµ;¸ù¾Ý½ÚµãµÄÀàÐͶø¶¨Òå
nodeType Number ½ÚµãµÄÀàÐͳ£Á¿ÖµÖ®Ò»
ownerDocument Document Ö¸ÏòÕâ¸ö½ÚµãËùÊôµÄÎĵµ
firstChild Node Ö¸ÏòÔÚchildNodesÁбíÖеĵÚÒ»¸ö½Úµã
lastChild Node Ö¸ÏòÔÚchildNodesÁбíÖеÄ×îºóÒ»¸ö½Úµã
childNodes NodeList ËùÓÐ×Ó½ÚµãµÄÁбí
previousSibling Node Ö¸ÏòÇ°Ò»¸öÐֵܽڵã;Èç¹ûÕâ¸ö½Úµã¾ÍÊǵÚÒ»¸öÐֵܽڵ㣬ÄÇô¸ÃֵΪnull
nextSibling Node Ö¸ÏòºóÒ»¸öÐֵܽڵã;Èç¹ûÕâ¸ö½Úµã¾ÍÊÇ×îºóÒ»¸öÐֵܽڵ㣬ÄÇô¸ÃֵΪnull
hasChildNodes() Boolean µ±childNodes°üº¬Ò»¸ö»ò¶à¸ö½Úµãʱ,·µ»ØÕæ
attributes NamedNodeMap °üº¬ÁË´ú±íÒ»¸öÔªËصÄÌØÐÔµÄAttr¶ÔÏó;½öÓÃÓÚElement½Úµã
appendChild(node) Node ½«nodeÌí¼Óµ½childNodesµÄĩβ
removeChild(node) Node ´ÓchildNodesÖÐɾ³ýnode
replaceChild(newnode,oldnode) Node ½«childNodesÖеÄoldnodeÌæ»»³Énewnode
insertBefore(newnode,refnode) Node ÔÚchildNodesÖеÄrefnode֮ǰ²åÈënewnodd
³ý½ÚµãÍ⣬DOM»¹¶¨ÒåÁËһЩÖúÊÖ¶ÔÏó£¬ËüÃ
Ïà¹ØÎĵµ£º
1
¡¢Àí½âdocument.all
[]
¡¡¡¡´ÓIE4¿ªÊ¼IEµÄobject
model²ÅÔö¼ÓÁËdocument.all
[],À´¿´¿´document.all
[]µÄDescription:
Array
of all HTML tags in the document.Collection of all elements contained by the
object.
¡¡¡¡Ò²¾ÍÊÇ˵document.all
[]ÊÇÎĵµÖÐËùÓбêÇ©×é³ÉµÄÒ»¸öÊý×é±äÁ¿£¬°üÀ¨ÁËÎĵµ¶ÔÏóÖÐËùÓ ......
javaScriptÑéÖ¤Ìá½»
¿´Àý:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT=""&g ......
Javascript´úÂë
<script>
var idTmr = "";
function copy(tabid){
var oControlRange = document.body.createControlRange();
oControlRange.add(tabid,0);
oControlR ......
// ´óѧÀï×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ×ö±ÏÒµÉè¼Æ£¬Ä¿Ç°Õý´¦ÓÚÕâ¸öʱÆÚ¡£
// £º£¨ :(
//
// Ê×ÏȼǼϵÄÊÇ Function µÄÒ»¸öÎÊÌâ
Function.prototype.method = function( name, func){
if( ! this.prototype[ name]){
this.prototype[ name ] = func;
}
} // ¸ø º¯ÊýÔÐÍÔö¼Ó·½·¨
//
// ¸øº¯ÊýÔÐÍÔö¼ÓµÄ·½·¨ÔÚ St ......
ÎÊ:
Hi,
I have this C#/ASP.NET/.aspx page with a string variable named myString with the value "Mario Gamito".
How can I access "Mario Gamito" from within a JavaScript function, i. e., the variable's value ?
Already tried '" + mystring + "' but it doesn't works.
Any help would be appreciated.
......