JavaScript Reference/Javascript Methods/deleteData

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

"deleteData()" Example

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

"deleteData()" is applied to

| Applied_To     |<comment>                       TextNode                      |

"deleteData()" Syntax, Parameters and Note

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