KEMBAR78
Js 1 | PDF | Java Script | Computer Programming
0% found this document useful (0 votes)
3 views18 pages

Js 1

JavaScript, introduced in 1995 as LiveScript, offers advantages like reduced server interaction, immediate user feedback, and enhanced interactivity, but has limitations such as lack of file access and networking capabilities. It is implemented within HTML using <script> tags, with optional semicolons and case sensitivity for identifiers. Modern browsers support JavaScript, but users of non-JavaScript browsers may face warnings.

Uploaded by

Daud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views18 pages

Js 1

JavaScript, introduced in 1995 as LiveScript, offers advantages like reduced server interaction, immediate user feedback, and enhanced interactivity, but has limitations such as lack of file access and networking capabilities. It is implemented within HTML using <script> tags, with optional semicolons and case sensitivity for identifiers. Modern browsers support JavaScript, but users of non-JavaScript browsers may face warnings.

Uploaded by

Daud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Javascript

Summary
History
• JavaScript made its first appearance in Netscape 2.0 in 1995 with the name
LiveScript.
• The JavaScript client-side mechanism provides many advantages over
traditional CGI server-side scripts. For example, you might use JavaScript to
check if the user has entered a valid e-mail address in a form field.
Advantages of JavaScript
• Less server interaction: You can validate user input before sending the page off to
the server. This saves server traffic, which means less load on your server.
• • Immediate feedback to the visitors: They don't have to wait for a page reload to
see if they have forgotten to enter something.
• • Increased interactivity: You can create interfaces that react when the user hovers
over them with a mouse or activates them via the keyboard.
• • Richer interfaces: You can use JavaScript to include such items as drag-and- drop
components and sliders to give a Rich Interface to your site visitors.
Limitations of JavaScript
• Client-side JavaScript does not allow the reading or writing of files. This has
been kept for security reason.
• JavaScript cannot be used for networking applications because there is no
such support available.
• JavaScript doesn't have any multithreading or multiprocessor capabilities.
JAVASCRIPT – SYNTAX
• JavaScript can be implemented using JavaScript statements that are placed
within the <script>... </script> HTML tags in a web page.
• You can place the <script> tags, containing your JavaScript, anywhere within
you web page, but it is normally recommended that you should keep it within
the <head> tags.
Cont
• The script tag takes two important attributes:
• • Language: This attribute specifies what scripting language you are using.
Typically, its value will be javascript. Although recent versions of HTML
(and XHTML, its successor) have phased out the use of this attribute.
• • Type: This attribute is what is now recommended to indicate the scripting
language in use and its value should be set to "text/javascript". So your
JavaScript syntax will look as follows.
Cont
Your First JavaScript Code
• Next, we call a function document.write which writes a string into our
HTML document.
Cont
• This function can be used to write text, HTML, or both. Take a look at the
following code.
Whitespace and Line Breaks
• JavaScript ignores spaces, tabs, and newlines that appear in JavaScript
programs.
Semicolons are Optional
• Simple statements in JavaScript are generally followed by a semicolon
character, just as they are in C, C++, and Java. JavaScript, however, allows
you to omit this semicolon if each of your statements are placed on a
separate line.
Cont
• var1 = 10
• var2 = 20
• But when formatted in a single line as follows, you must use semicolons:
var1 = 10; var2 = 20;
Case Sensitivity
• So the identifiers Time and TIME will convey different meanings in
JavaScript.
Comments in JavaScript
• Any text between a // and the end of a line is treated as a comment and is
• ignored by JavaScript.
• Any text between the characters /* and */ is treated as a comment. This may
span multiple lines.
Example
JAVASCRIPT – ENABLING
• All the modern browsers come with built-in support for JavaScript.
• Internet Explorer
• Firefox
• Chrome
• Opera
Warning for Non-JavaScript Browsers

You might also like