JavaScript Reference/Javascript Methods/deleteData — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

"deleteData()" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
   var m = document.createTextNode("This is the text.");
   var n = myP.firstChild.replaceNode(m);
   m.deleteData(5, 10); 
} 
</script>
<p id="myP">Sample text.</p>
<input type="button" value="Remove data" onclick="function1();">
</body>
</html>



"deleteData()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<comment>                       TextNode                      |
+----------------+--------------------------------------------------------------+



"deleteData()" Syntax, Parameters and Note

Note:
Deletes a string from the object.
    
Syntax:
    
textNodeName.deleteData(param1, param2) // IE only
document.getElementById("commentID").deleteData(param1, param2)
document.all.rumentID.deleteData(param1, param2) // IE only
Parameters:
    param1   Required; the first character in the string to remove.
    param2   Required; the number of characters to remove.