Action on button-click
Website content updates timely
What's the secret behind Web-Maps (Google Maps) ?
Online 2D,3D Games
How can I be one of them?
Lots of students/ people who are learning web design has a doubt, Can I be a developer someday? The answer is "Yes, you can". Only thing you need to do is...
Learn well. Practise well. Create your own style. Work on a new idea
Besides those popular methods we prefer you something special
Now re-save the document and open it with your web browser
You must see the result! If not, there must be a bug in your code. Debugging is a great skill every developer must have. So, don't worry try again. By the way, you'll learn how to debug in the later chapters
We don't cover HTML tutorials here. If you need to learn HTML we prefer w3schools. Also there are many other websites you can learn HTML.
The <script> tag
Before the script
After the script
Button tag defines a button
onclick= defines a JS code to run when the user clicks on the button
We have already discussed how to add a script tag internally. Unlike in-line, this scripts can define functions, variables, loops and more.
Script tag tells the browser that this is a internal script. The use of internal scripts are different from in-line scrips. While in-line scripts are used to define something special to the element it is in, these can handle anything all over the web page.
alert('Hello World') does the same as the previous example. But here, the code is executed as soon as the script is loaded.
type attribute is a old standard and it's not required now. But, always use it when you add an external script to html, because still there are number of users who are using old browsers.
src attribute is the special part when adding external scripts to the document. It defines the path of the script. (It can be either absolute path or relative path)