JavaScript is a scripting language that will allow you to add real programming to your webpages.
JavaScript can be implemented into web pages in many different ways.
Text
HTML Tags
Body
Head
External JavaScript
Typically this is how JavScript would be embedded into a simple HTML web page
<html>
<body>
<script type="text/javascript">
document.write("Hello World!");
</script>
</body>
</html>
To insert a JavaScript into an HTML page, we use the <script> tag. Inside the <script> tag we use the "type=" attribute to define the scripting language.
So, the <script type="text/javascript"> and </script> tells where the JavaScript starts and ends:
The word document.write is a standard JavaScript command for writing output to a page.
By entering the document.write command between the <script> and </script> tags, the browser will recognize it as a JavaScript command and execute the code line. In this case the browser will write Hello World! to the page.
Here is a JavaScripted web page that you can try
<script type="text/javascript">
function changeText2(){
var userInput = document.getElementById('userInput').value;
document.getElementById('boldStuff2').innerHTML = userInput;
}
</script>
<p>Welcome to the site <b id='boldStuff2'>dude</b> </p>
<input type='text' id='userInput' value='Enter Text Here' />
<input type='button' onclick='changeText2()' value='Change Text'/>
*** Copy and paste to notepad and save as JavaScript.html
JavaScript Quick Tutorial

Placehold- TWS Manager

- Age: 25
Number of posts: 730
Registration date: 2008-04-15
Computer Specs: Windows Vista home premium :: Intel(R) Core(TM) Duo CPU
Additional Specs: T7250 @ 2.00GHz :: 4.00 GD RAM :: NVIDIA GeForce 8400M GT
- Post n°1







View the profile