JavaScript Reference/Javascript Methods/createDocumentFragment

Материал из Web эксперт
Перейти к: навигация, поиск

"createDocumentFragment()" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
   var newDoc = document.createDocumentFragment();
   newDoc.innerHTML = "<p>some text</p>";
   alert(newDoc.innerHTML); 
} 
</script>
<input id="myT" type="button" value="Click me" onclick="function1();">
</body>
</html>



"createDocumentFragment()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |document                                                      |
+----------------+--------------------------------------------------------------+



"createDocumentFragment()" Syntax, Parameters and Note

Note:
Creates a new document object.
    
Syntax:
    
document.createDocumentFragment()