JavaScript Reference/Javascript Methods/substringData — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
"substringData()" Example
<html>
<body>
<script language="JavaScript">
function function1() {
var range = document.all.myP.firstChild;
var m = range.substringData(5, 10);
alert(m);
}
</script>
<p id="myP">This is a sample text.</p>
<input type="button" value="Extract data from 5 to 10" onclick="function1();">
</body>
</html>
"substringData()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<comment> TextNode |
+----------------+--------------------------------------------------------------+
"substringData()" Syntax, Parameters and Note
Note:
Returns a string from the text object.
Syntax:
textNodeName.subStringData(param1, param2) // IE only
document.getElementById("commentID").subStringData(param1, param2)
document.all.rumentID.subStringData(param1, param2) // IE only
Parameters:
param1 Required; start index.
param2 Required; the length of the subset string.