Introduction to JavaScript, Part 1
Luka Abrus
Technology Specialist, Microsoft Croatia
JavaScript is the scripting language used on millions of Web pages. Its main purpose is
to add interactivity to the browser and Web pages. It also complements very popular
server-side programming languages and platforms, like ASP.NET (actually, JavaScript is
used in many ASP.NET controls). As it is very easy to learn, you'll soon start writing your
first scripts. It doesn’t matter if you're already an expert or just a beginner in the world
of web development – JavaScript will add that "extra something" to your Web pages.
This guide assumes you have some prior knowledge of HTML and how web pages work.
What is JavaScript?
To understand JavaScript, you first need to understand what client-side scripting is.
After you have mastered HTML and CSS, it is time to move one step forward. As you’ve
seen up until now, the biggest limitation of HTML is that it is static. The page you’ve
created will be shown to all visitors in the same way. For example, what if you wanted to
show the current date on the Web page? Would you update its code each morning (or,
better, after midnight) and upload it to the server? What if you came up with an even
crazier idea of always having the current time on the page? Would you update your
HTML every second?
Luckily, you aren’t limited to only HTML. There are lots of different technologies that are
just waiting to be used on your pages to create dynamic content! In this guide, we’ll
focus specifically on JavaScript. But before we move on, one more thing – what is
actually a script? So far, all of your pages were static and written in HTML. By adding
scripts, you are actually adding programming code to your pages. This code will run
when the page loads, and it will add new functionality, interactivity and dynamic effects,
unlike the HTML code used only for describing and formatting the page.
Client and server
Who is hiding behind the word “client” when talking about Web technologies? When you
request a Web page by entering its address in the browser’s address bar, you and your
browser are becoming a client. As in the real world, you have requested a service and
therefore you are a client. On the client-side, as you’ll see, your browser does all the
work of processing the service and displaying the page.
JavaScript is a client-side scripting language. In order to understand what that means,
you need to understand what the terms “server-side” and “client-side” mean. Let’s look
at how the process of requesting a Web page goes.
评论0