'String' Example : String « Javascript Objects « JavaScript Reference

'String' Example

    
<html>
<body>
<div id="myDiv" style="width:100; height:100;">This is some sample text</div>
<script language="javascript">
function function1(){
    var temp = new String(); temp = myDiv.innerText; alert(temp); 
} 
</script>
<button onclick="function1();">String function</button>
</body>
</html>

    
      
      








Related examples in the same category

1.'String' Syntax and Note
2.'String' JavaScript Properties
3.'String' JavaScript Methods