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

JavaScriptÖÐDOMÊ÷µÄNode½Ó¿ÚµÄһЩ¼òµ¥Ó¦ÓÃ

1. ÓÃÀàÃû²éÕÒÔªËØ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">
<html xmlns="http://www.w3.org/1999/xhtml
" >
<head>
<title>Untitled Page</title>
<script type="text/javascript
">
//±¾Ò³·½·¨:ÓÃÀàÃûÑ¡ÔñÔªËØ
function
getElements(cla) {
var
elements = document
.getElementsByTagName("*
");
var
elems = [];
for
(var
i = 0; i < elements.length
; i++) {
if
(elements[i].className && has(elements[i].className,cla)) {
elems.push(elements[i]);
}
}
return
elems;
}
function
has(ele, name
) {
var
clla = [];
if
(ele) clla = ele.split(' ');
for
(var
i = 0; i < clla.length
; i++)
if
(clla[i] == name
) {return
true
};
return
false
;
}
</script>
<style type="text/css
">
.h
{background-color:Aqua;
}
</style>
</head>
<body>
<i id="iiii
" class
="h
">Just test.</i><br />
<span id="ssss
" class
="h
">hehe</span>
<script type="text/javascript
">
var
e = getElements("h
");
var
nn = ""
for
(var
i = 0; i < e.length
; i++) {
nn +="id:
" + e[i].id + "\n
";
nn += "------line------\n
";
}
alert
(nn);
</script>
</body>
</html>
<
script
>
// This function takes a Node n, replaces it in the tree with an Element node
// that represents an HTML <
b
>
tag, and then makes the original node the
// child of the new <
b
>


Ïà¹ØÎĵµ£º

JavaScriptʵÏÖ panelµÄÏÔʾÒþ²Ø

<script language="javascript">
    function closeOpen(Panel) {
        var test = document.getElementById('Panel');
        if (test.style.display == "none") {
       &nb ......

javascript³£ÓÃ

calcu()  ----º¯ÊýʵÏÖÁ½¸öÊýÏà³Ë
document.write();  ---´òÓ¡
document.calc.ÔªËØÃû.value;  --»ñµÃ±íµ¥µÄÖµ
document.±íµ¥Ãû¡£±íµ¥ÔªËØÃû¡£value  Ϊ±íµ¥¸³Öµ
¶¨Ò庯Êý£º
 function  Ãû×Ö()
 {
    //javaScriptÔ¤Óï¾ä
 }
 onClick="º¯ÊýÃû";  ......

ÓÉdzµ½ÉîÁ˽âJavaScriptÀà

ÀàÊÇʲô£¿
    
   Ðí¶à¸Õ½Ó´¥±à³ÌµÄÅóÓѶ¼¿ÉÄÜÀí½â²»ÁËÀ࣬ÆäʵÀàÊǶÔÎÒÃÇÕâ¸öÏÖʵÊÀ½çµÄÄ£Ä⣬°ÑËü˵³É“Àà±ð”»òÕß“ÀàÐÍ”¿ÉÄÜ»á¸üÈÝÒ×Àí½âһЩ¡£±ÈÈç“ÈË”ÕâÖÖ¶¯
Îï¾ÍÊÇÒ»¸öÀ࣬¶ø¾ßÌåijһ¸öÈ˾ÍÊÇ“ÈË”Õâ¸öÀàµÄÒ»¸öʵÀý
£¬
“È ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ