JavaScript Reference/Javascript Methods/insertData
Версия от 18:30, 25 мая 2010; (обсуждение)
"insertData()" Example
<html>
<body>
<script language="JavaScript">
function function1() {
var m = document.getElementById("myP").firstChild;
m.insertData(10, "INSERTED TEXT")}
</script>
<p id="myP">Sample text paragraph</p>
<input type="button" value="InsertData" onclick="function1();">
</body>
</html>
"insertData()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<comment> TextNode |
+----------------+--------------------------------------------------------------+
"insertData()" Syntax, Parameters and Note
Note:
Adds a string inside the element.
Syntax:
textNodeName.insertData(param1, param2) // IE only
document.getElementById("commentID").insertData(param1, param2)
document.all.rumentID.insertData(param1, param2) // IE only
Parameters:
param1 Required; the character position.
param2 Required; the string to be inserted.