background preloader

Java Script

Facebook Twitter

Timeline .NET. Timeline. InnerHTML. Ever wonder how you could change the contents of an HTML element? Maybe you'd like to replace the text in a paragraph to reflect what a visitor has just selected from a drop down box. By manipulating an element's innerHtml you'll be able to change your text and HTML as much as you like. Each HTML element has an innerHTML property that defines both the HTML code and the text that occurs between that element's opening and closing tag. By changing an element's innerHTML after some user interaction, you can make much more interactive pages. However, using innerHTML requires some preparation if you want to be able to use it easily and reliably. After you have that set up you can now manipulate the text of an element. JavaScript Code: <script type="text/javascript"> function changeText(){ document.getElementById('boldStuff').innerHTML = 'Fred Flinstone'; } </script><p>Welcome to the site <b id='boldStuff'>dude</b></p><input type='button' onclick='changeText()' value='Change Text'/> Display:

JavaScript Array Object.