.


:




:

































 

 

 

 





replaceChild() , , . , . ,

var oItem = document.createElement("LI")

oItem.appendChild(document.createTextNode("JScript"))

oList.replaceChild(oItem, oList.lastChild)

"JScript", . .

:

<UL ID="components">

<LI>HTML</LI>

<LI>CSS</LI>

<LI>JScript</LI>

</UL>

, , :

oList.lastChild.firstChild.nodeValue= "JScript"

: removeChild() removeNode()

removeChild() . . ,

var oRemovedItem = oList.removeChild(oList.lastChild)

. . , , . oldChild newChild.

currentNode.replaceChild(newChild, oldChild)

, removeNode(). W3C, . Boolean. false, , . , . true, . , .

var oRemovedList = oList.removeNode(true)

removeNode() . , .

DOM

DOM style, . , "samplePtag", document.getElementById("samplePtag").style.color = red.

CSS (http://www.w3.org/Style/CSS/#specs).

innerHTML outerHTML

innerHTML outerHTML , .

innerHTML HTML- . , . : COL, COLGROUP, HTML, STYLE, TABLE, THEAD, TITLE, TR. innerHTML , ( <br>).

outerHTML , HTML- , .

: CAPTION, COL, COLGROUP, HTML, TBODY, TD, TH, THEAD, TR. outerHTML , , .. window.onload.

outerHTML. , :

<INPUT TYPE="submit" VALUE=""

onClick="this.outerHTML=' .'">

, W3C DOM:

<INPUT TYPE="submit" VALUE=""

onClick="replaceButton(this)">

<script type="text/javascript">

function replaceButton(oButton) {

var oText = document.createTextNode(" .")

var oParent = oButton.parentNode

oParent.replaceChild(oParagraph,oButton)

}

</script>

 

innerHTML outerHTML:

<!-- pr31: -->

<html><head>

<script type="text/javascript">

function transformBody() {

var myPar = document.getElementById("myP");

myP.innerHTML = "<i>Hello, World!</i>";

myP.outerHTML = "<strong>" + myP.innerHTML

+ "</strong>";

}

</script>

</head>

<body onload="transformBody();">

<p id="myP">sample text</p>

</body>

</html>

<!-- body :

<BODY><STRONG><I>Hello, World!</I></STRONG></BODY>

-->





:


: 2016-07-29; !; : 385 |


:

:

, .
==> ...

1689 - | 1541 -


© 2015-2024 lektsii.org - -

: 0.012 .