|
What is JavaScript? |
Ans:) JavaScript is a scripting language designed for adding interactivity to HTML
pages.The language was first implemented by Netscape Communications in Netscape
Navigator 2 beta (1995).JavaScript is different from the java language (developed at
Sun crosystems).However, the two languages can interoperate well.
JavaScript programs, or scripts, are usually embedded directly in HTML files.
The script executes when the user's browser opens the HTML file. (There is also
server-side JavaScript, but it's beyond he scope of this FAQ collection.)
JavaScript is an interpreted language. This means that scripts execute
without preliminary compilation, i.e. without conversion of the script text into a
system-dependent machine code. The user's browser interprets the script, that
is,analyzes and immediately executes it.
JavaScript is supported by the following browsers:
- Netscape Navigator (beginning with version 2.0)
- Microsoft Internet Explorer (beginning with version 3.0)
- Any other browser/product whose vendorlicensed or implemented JavaScript interpreter (for example, Opera).
|
| |
| What can JavaScript programs do? |
Ans:) The following list presents only some groups of typical tasks in which
JavaScript proves very useful:
- Giving the user more control over the browser
- Detecting the user's browser, OS, screen size, etc.
- Performing simple computations on the client side
- Validating the user's input
- Handling dates and time
- Generating HTML pages on-the-fly without accessing the Web server.
|
| |
| What can't JavaScript programs do? |
Ans:) JavaScript code cannot do any of the following:
- use printers or other devices on the user's system or the client-side LAN
- directly access files on the user's system or the client-side LAN ;the only
exception is the access to the browser's cookie files.
- directly access files on the Web server.
- implement multiprocessing or multithreading or multi-tasking.
If you do need to access files or perform other"privileged" operations, you
can use JavaScript in combination with a Java applet.Signed Java applets are allowed
to do "privileged" things, and your JavaScript programs can exchange information withapplets.However,you have to bear in mind the biggest JavaScript/Java limitation: the user can always disable Java or JavaScript or both!
|
| |
| How do I print JavaScript output? |
Ans:) JavaScript programs cannot directly access printers.However,the user can print out everything on the Web page,including the output of JavaScript programs, by using the File | Print menu of the browser (or the keyboard shortcut,e.g. Ctrl+P on Windows systems).
If your script outputs data that users would often print out,then just remind
them to use the File | Print menu.Also, your script might generate the printable
data in a separate browser window .
|
| |
| |
| |
|
| |