There are three general areas that JavaScript can be placed for use in a webpage.
External JavaScript files and their uses will be discussed in the next lesson.
- Inside the head tag
- Within the body tag (like our example in the previous lesson)
- In an external file (we'll talk about this next lesson)
External JavaScript files and their uses will be discussed in the next lesson.
An Example Head Script
Since we have already seen the kind of script that goes in the body, how about we write a script that takes place when some event occurs? Let's have an alert show up when a user click on a button.HTML & JavaScript Code:
<html> <head> <script type="text/JavaScript"> <!-- function popup() { alert("Hello World") } //--> </script> </head> <body> <input type="button" onclick="popup()" value="popup"> </body> </html>
0 comments
একটি মন্তব্য পোস্ট করুন