DOM???????????
???????????? ???????[ 2015/8/31 13:24:29 ] ??????????????? WEB????
????DOM?????????????????????????????????jQuery??????????????DOM?????????′????????“????”???????????ò??????????????????????????DOM??????????????????????????????????DOM?????????????????????????????????????^ ^??
???????DOM??????
????DOM??????????????????HTML??XML????????API?????DOM?????????????
???????????????????????????????
?????????????????????HTML???????η?????????????????????????????????????????????????
????DOM????????????????????????????????????????????getElementById??????????insertBefore????????
???????????????HTML??????????????DOM????
????????????DOM???????????????????HTML???????????????
???????????HTML???????????Document????????????????????????????????document?????????????HTMLDocument???????浥??????Document??????????????
???????仰??????????????Document????????????????????document.getElementsByTagName(“html”)?????????????????Element html??
????????HTML????????????????????????磺
????HTML??????????????????????????????????????????????????????
?????????????12?????????????Щ????????????Node?????
?????????????????Node????????????????????????н?????е??
????????Node????????????н????????????????
????Node?????н????????????н??????????????????н?????Щ???????????????
???????Node?????????
??????????nodeType?????????????????????????磺
????document.nodeType; // ???? 9 ??????document???????????Document?????
?????????棬9???????DOCUMENT_NODE????????????????Node.DOCUMENT_NODE?????????????
????document.nodeType === Node.DOCUMENT_NODE; // true
???????????????Щ??????????????????????????????????????????????????????????Element(????????1)????????Text(????????3)
?????????????nodeName??nodeValue
????????????? nodeName????????nodeValue??null
?????????????? nodeName?”#text”(chrome????????)??nodeValue???????
????????????childNodes?????????????????????????????????????????????????
????????childNodes??????????NodeList???????????????飬????????????????????????????????????ε??????????DOM???????????????????????????????????
????????childNodes????????????±????item????
????????????????????????????????????????????????????
??????????????????????
????1??hasChildNodes()
?????????????????true??????childNodes??length???????
????2??ownerDocument
??????????????????????html???????document????
???????????Node???????????
????appendChild()?????????????childNodes???β???????????????????????????????????????????е????????????????о??????????????????
????insertBefore()?????????????????????????????????????????????????????????null????insertBefore??appendChildЧ????????????????????????????????????????????????????????null??????????????????????????
????replaceChild()?????????滻????????????????????????????????滻??????????滻?????
????removeChild()???????????и??????????????????????? #waste-node ????????????????
????var wasteNode = document.getElementById("waste-node");
????wasteNode.parentNode.removeClhid(wasteNode); // ???????????????removeClild??????
???????????????£??????????????У?????????????????????????????????????????????????????????parentNode?????
????????????????????????
????cloneNode();????????????????? true????false?????true?????????????????????????false????????????????????????????κ????????????????????????????????????????????????????潲??4???????????????????html?????
?????????Node????????????????????????????????????????н????????????Node???????????Щ?????????н???е??
????????Document????
?????????DOM?????????????Document?????????????????????????????????????HTMLDocument????????????document???????document????????????????????????
????document???????????window????????????????????????????document???
??????????????document????????????????????????
????document????????Щ????
????document.childNodes ????????潲??Node????????????????????????????????????????html???
????document.documentElement ??????????html??????????????document.getElementsByTagName(“html”)[0]????
????document.body body????????
????document.title ????title?????????????????????????????
????document.URL ????url
????document.referrer ???referrer?????????????????????????????????????????
????document.domain ???????????????????????????????????????????????????????Щ?????????????????Ч??
??????????????????????????
????getElementById ?? getElementsByTagName
????getElementById??????id???????????????????????Сд??IE8-????????????????ж??id???????????????????IE7-??????????name???????id????á?
????getElementsByTagName ????????????????????HTMLCollection??????????????? “*” ?????????????????
????????????????HTMLDocument????????document???????е???? getElementsByName ??????壬????name????????
????document???????Щ?????????document.forms ??????????е?form????????????HTMLCollection??
???????HTMLCollection????????
????HTMLCollection?????????????????????????????潲??NodeList???????HTMLCollection????????????????????????????±?????.item()??????????????????????['name']??????.namedItem()????t???????
??????????document????????????????????????
????write() writeln() open() close()
????open??close??????????????????????????????????У?????open??????????????????????????
?????????????????write??writeln??????????????д??????????????????????????з???
????????????????????????У??????????????????????????????????????????????????????write??????д??????檔
??????????????????д????? ???? <script>xxx</script>?????? ??????????</script>????????£???????????????????????????????????????????????????????????????д”<scr” + “ipt>”;
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11