Some Common FAQ about Javascipt

 

Are Javascript and Java the same?

No, they are two completely different computer languages. Only their names are similar. Actually Javascript is not Java and Java is not Javascript. You can say Java and Javascript is two different Animal.

What do we need to run Javascript?

Javascript support is built right into web browsers. Provided that the visitors to your site are using web browsers that support Javascript (most do) and have Javascript enabled (it is by default) then your Javascript will run.

Do I need to learn Javascript to be able to use it?

No. There are plenty of Javascripts that have already been written that people have made available for you to plug straight into your web page. All you need to know to be able to use such scripts is how to paste the supplied code into the required places in your web page.

What do I need to write Javascript?

Javascript is an interpreted language and so no special program is required to be able to create usable code. Any plain text editor such as Notepad is quite satisfactory for being able to write Javascript. That said, an editor which colourizes the code to make it easier to see what is what makes it easier to find your mistakes but then my Javascript Formatter can reformat your script to make errors even easier to spot.

Can I use HTML instead of Javascript?

No. HTML and Javascript are two completely different things. HTML is a markup language designed for defining static web page content. Javascript is a programming language designed for performing dynamic tasks.

Can I use PHP or some other server side language instead of Javascript?

Perhaps, it depends on where the code needs to run. If it can run before the page loads you can use a server side language. If it has to run after the page has loaded then you must use Javascript as this is the only scripting language supported by all web browsers that support client side scripting.

Does the Javascript go in the same file as the HTML?

It can but your scripts will be more easily reused on multiple pages of your site if you place them in separate files (using a .js extension helps identify them as Javascript). You then just link the Javascript to your HTML by inserting a <script> tag. The same Javascript can then be added to several pages just by adding the appropriate tag into each of the pages to set up the link.

 

  • Share/Save/Bookmark

Leave a Reply

Your email address will not be published. Required fields are marked *