Explain about Java Script? Mention Benefits and Problems with Java Script?
https://www.computersprofessor.com/2016/06/explain-about-java-script-mention.html?m=0
Java script is a scripting language
used to produce dynamic web pages. HTML language which is called as web
designing language produces static web pages.
Static
web page is a web page that is loaded into browser when HTML program is
executed. Once
webpage is loaded into web browser it displays the content with specific
format and appearance. These contents
cannot be changed, their format and appearance when they are displayed inside
the web browser.
To
change the content and format of it we have to modify source HTML program
and re execute the program again. This is called the static web page.
When
Java script program is executed the web page is loaded into web browser and
display some content with certain format and appearance. The contents and
their appearance is changed within the web browser because of some time
events that occur in web browser. This is called dynamic web page.
Dynamic
web page is a combination of content formatted using html, css, discripting language
and DOM(Document object model).
Benefits of Java Script:
Java script is a client slide
scripting language.
Java script provides dynamic and interactive
web pages.
Java script uses html tags for web
designing and programming facilities to produce dynamic web page contents.
Java script is supported by all web browsers.
Java script is secure, when these
programs are distributed in network.
Java script can neither read from
your local hard drive get a virus injection directly from java script.
Java script supports animation
without plugins to use your script.
We know that in case of html program
there is no need of compilation to run the program.
If java script code is written, it
requires compilation for execution here compilation is called interpretation.
Java script can view interesting
animations without the long downloading times associated with many multimedia
data types.
It gives easy access to the document
object and can manipulate most of them.
|
Problems with Java Script:
If your script doesn’t work then
your page is useless.
Script can run slowly and complex
scripts can take long time to start.
The key points that you need to
apply in all scripts:-
Java script programs contain
variables, objects and functions.
Each line of code is terminated by
a ‘;’.
We can place script tag in either
in head or body section.
Blocks of code must be surrounded by
a pair of curly braces.
The block of code is set of instructions that are to be executed.
Functions have parameters which are
passed through inside parenthesis().
Variables are declared using the key
word “var”.
Scripts require neither a main
function nor an exit condition.
These are main differences between
scripts and programming languages.
Execution of a script starts with
the first line of the code and run until there is no more code.
Structure of Java script
program:
Syntax:
1) < html>
< head>
< title > java script </title>
< script language = “ Java script”>
- - - - - - - - - -
- - - - - - - - - -
</script>
</head >
<body>
- - - - - -
- - - - - -
</body >
</html>
(or)
|
2) < html >
< head >
< title > Java script </title>
< /head>
< body>
< script language = “ Java script”>
- - - - - - -
- - - - - - -
</script>
</body>
</html>
Eg:
<html>
<head>
<title> Java script </title>
<script language = “ java script”>
document. write undefined“ <h1 > This is my first java script program lt;/h1>”);
</script>
</head>
<body>
- - - - - - -
- - - - - - -
</body>
</html>
|