Introduction to JavaScript

JavaScript is an online scripting language that is implemented and works directly with HTML pages. Similar to Flash and ActionScript, JavaScript brings a dynamic nature to web pages that does not require the page to change. Obviously, this functionality is very useful for a wide variety of reasons. JavaScript can make a developer’s life a lot easier in a lot of ways. On the other hand, the various down sides of implementing JavaScript are significant—sometimes too much so.

Any time that a developer would like to change the content of a web page without actually changing the page, JavaScript is a natural option. Flash and ActionScript is basically the only other option. A developer may decide to use JavaScript for a variety of reasons, many of which include the various down sides of Flash development. However, one of the main reasons for a developer’s choice might be that they are not familiar with Flash. JavaScript is much easier to learn for individuals that are not as creatively inclined.

Because JavaScript is integrated directly into the web page, there is not as much issue with file size or compatibility as there is with Flash. JavaScript does not take long to load and does not typically place any undue burden on the computer. JavaScript also makes everything a little cleaner, since you are not dealing with multiple files or confusing embed code. JavaScript has the added bonus of not affecting the ability of search engines to index all of the information on a web page (like Flash does).

Unfortunately, JavaScript developers are deeply impacted by the growing number of people that disable JavaScript code in their browsers. Some people find JavaScript to be annoying and would rather deal with a static page than with a changing one. Other people are worried about certain security issues that JavaScript has. Whatever the reasons, it means that it is no longer considered good development practice to create a website that relies upon JavaScript. While it can be included for a cool effect or extra functionality, the core website should be able to operate entirely without JavaScript.

Of course, there are certain applications that call for JavaScript and others that call for Flash/ActionScript. An experienced developer can identify those specific applications and take care of them accordingly. For any applications that can be implemented by either, it is generally just a matter of personal preference.

{mospagebreak title=Relation to Java}

One of the first questions many people have is: how is JavaScript related to Java? In fact, some people even confuse the two, since Java does have some limited application online. In reality, JavaScript is kind of like an estranged nephew of Java. While some of the principles, syntax, and functions of JavaScript trace their origins to Java, the two are quite fundamentally different.

Most notably, Java is a full-blown programming language where JavaScript is just a simple scripting language whose only application is online. Java contains an incredible amount of power where JavaScript only has what power it needs to do some cool things on a web page. While it is arguable that simple functions are all that JavaScript requires as an extension of Java to web pages, it is very difficult to compare the two since there is such a wide disparity between their respective abilities.

Java is well known for being an OOP (Object-Oriented Programming) language. JavaScript, on the other hand, mainly utilizes traditional syntax and structures. This is one of the largest differences between the two languages. Because one of the primary identifying features of Java is that it is entirely based on OOP principles, JavaScript is definitely not closely related.

JavaScript, while not being an OOP language, does share some of the OOP principles of Java. For instance, it does deal with properties of certain objects (such as the screen, tags in the HTML code, etc.). These properties are accessed and modified in a similar fashion to how they are in Java.

Oddly, JavaScript is actually much closer to ActionScript than it is to Java. If you develop a small script in either ActionScript or JavaScript, it can often be transferred to the other with a minimum amount of correction and change. This similarity can be very useful, as it is not uncommon for a developer to learn both languages to be able to implement the best solution possible.

JavaScript is also much closer to ActionScript in its native environment than it is to Java. While Java can be implemented on the Internet, it requires a runtime environment to work, just as it does when run locally. While ActionScript does require some software to be installed for the browser to display Flash files (Flash player), this small program is not a runtime environment. JavaScript, of course, does not require any additional installations or software to operate.

{mospagebreak title=Real-time Nature}

The major addition of JavaScript to a web page, as mentioned, is its real-time dynamic capabilities. JavaScript allows a developer to change the content that appears on a page without changing the page itself. If this does not mean much to you, then you can basically think of it as something like a drop-down menu or pop-up “window.”

The real-time nature of JavaScript is what differentiates it from all other dynamic languages online. PHP, for instance, is a much more powerful language that JavaScript. However, (in general) in order for PHP to change content, a page must be refreshed.

PHP is executed before the HTML of a page, and cannot change any content after the HTML has been loaded. This severely limits the application of PHP (and other languages like it) to creating applications that rely upon real-time content changes.

If you are more technically inclined, then you probably already know about HTML and how it is code that drives the appearance of a web page. While PHP can change the code behind the HTML, it can only do it before the user sees it.

JavaScript, on the other hand, is executed at the same time as HTML. This is what allows it to change content on the page after it has been loaded. Just as HTML is always present on the page, JavaScript is always ready to operate as long as the window is open.

One of the only other languages which provides a similar application to JavaScript is CSS. CSS is intended to determine the visual aspects of elements on web pages; it is not truly even a scripting language. However, it does have some abilities to change the appearance of a page after it has been loaded. For instance, it can take advantage of the “rollover” (when the mouse hovers over something) attribute of objects to change appearances of different items as the user is navigating the page. However, because CSS is not a real scripting language, is use for real-time dynamic capabilities is far more limited than JavaScript’s.

{mospagebreak title=Application}

One of the most common applications of JavaScript is to create a drop-down menu. These menus are very common, and have been for quite a few years online. While the implementation of JavaScript for this purpose is not simple, the effect is so notable that many developers (even less skilled ones) will find one way or another to implement a JavaScript drop-down menu. Many developers simply make use of pre-existing code on various websites.

Similar to its application for drop-down menus, JavaScript has also traditionally been used for rollover buttons. While this is a simpler application of JavaScript than a drop-down menu, it is still not a simple process (as it would be in Flash, for instance).

JavaScript’s use for these two purposes has declined significantly in recent years. CSS has come to dominance, and its rollover capabilities make JavaScript obsolete. While many users disable JavaScript in their browsers, they do not (and cannot) disable CSS. It is no longer considered proper development practice to use JavaScript for navigation functions. However, CSS’s implementation for drop-down menus is relatively complex and not understood by most. Therefore, the transfer of drop-down menus from JavaScript to CSS has progressed slower than that of rollover buttons.

Another one of JavaScript’s primary functions is to launch new windows and pop-up messages. It serves both of these functions quite well, and they are considerably easier to implement than navigation applications. Pop-up windows are often one of the first applications that new developers learn when pursuing an education in JavaScript.

Beyond these most common functions, the uses of JavaScript vary widely. There are plenty of options for a creative developer with an extensive knowledge of JavaScript. Because JavaScript is a relatively complex language and is slowly falling out of vogue with developers, it is becoming more and more rare to find extensive JavaScript applications online.

Despite JavaScript’s decline, most developers will come across a situation from time to time that calls for JavaScript implementation. The functionality that JavaScript offers with real-time dynamic power is invaluable at times. Although JavaScript can often be replaced by some other language or method, it still remains the most effective solution for a wide range of applications.

[gp-comments width="770" linklove="off" ]
antalya escort bayan antalya escort bayan