JavaScript Tutorial/DOM Node/innerText — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 11:24, 26 мая 2010
Assign value to the innerText node
<source lang="javascript">
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>
Hello world
<input type="button" value="Use InnerText" onclick="useInnerText()" /> </body>
</html></source>
Change the innerText
<source lang="javascript">
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 = "Hello world"; } </script> </head> <body>
This is my original text
<input type="button" value="Use InnerText" onclick="useInnerText()" /> </body>
</html></source>