JavaScript Tutorial/DOM Node/innerText — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:24, 26 мая 2010
Assign value to the innerText node
Firefox does not support the innerText property.
<html>
<head>
<title>InnerText Example</title>
<script type="text/javascript">
function useInnerText() {
var oDiv = document.getElementById("div1");
oDiv.innerText = oDiv.innerText;
}
</script>
</head>
<body>
<div id="div1"><b>Hello</b> world</div>
<input type="button" value="Use InnerText" onclick="useInnerText()" />
</body>
</html>
Change the innerText
Firefox does not support the innerText property.
<html>
<head>
<title>InnerText Example</title>
<script type="text/javascript">
function useInnerText() {
var oDiv = document.getElementById("div1");
oDiv.innerText = "<b>Hello</b> world";
}
</script>
</head>
<body>
<div id="div1">This is my original text</div>
<input type="button" value="Use InnerText" onclick="useInnerText()" />
</body>
</html>