0% found this document useful (0 votes)
12 views

Lec 20

JavaScript has some limitations including not being able to perform graphics tasks, read or write files due to security restrictions, or support multithreading. It can write HTML, control the browser window, interact with forms and users. JavaScript debugging involves bringing up the console in Netscape/Mozilla/Galeon or checking settings in Internet Explorer. The Document Object Model (DOM) represents the document as a hierarchical tree with the browser window at the root and scriptable elements like paragraphs as children, allowing scripts to dynamically access and manipulate objects.

Uploaded by

postscript
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lec 20

JavaScript has some limitations including not being able to perform graphics tasks, read or write files due to security restrictions, or support multithreading. It can write HTML, control the browser window, interact with forms and users. JavaScript debugging involves bringing up the console in Netscape/Mozilla/Galeon or checking settings in Internet Explorer. The Document Object Model (DOM) represents the document as a hierarchical tree with the browser window at the root and scriptable elements like paragraphs as children, allowing scripts to dynamically access and manipulate objects.

Uploaded by

postscript
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PS, PDF, TXT or read online on Scribd
You are on page 1/ 5

Limitations of JavaScript

Can not do anything beyond HTML- and browser-related


tasks

Does not have any graphics capabilities

Can’t read from or write to files (security restrictions)

Does not support networking (but can make a Web


browser download an arbitrary URL)

Does not have multithreading capabilities


What JavaScript Can Do
Can write arbitrary HTML into the document and can
generate documents from scratch

Can control browser


open new windows, change appearance of windows, access history and
move forward and backward, display messages in the status line

Can interact with forms (check and set fields) and with the
user

Can read and write client cookies


JavaScript Debugging
In Netscape/Mozilla/Galeon simply bring up JavaScript
console. You can do that via GUI menus or by typing
"javascript:" in the url field

In IE:
1. check "Display a notification about every script error" under the
Advanced tab of your Internet Options

2. uncheck "Disable Script Debugging" under the Advanced tab of your


Internet Options
Document Object Model (DOM)
When a page loads into a scriptable browser, the browser
creates an internal representation of that page, which
includes all elements on the page that the browser
recognizes as scriptable objects

The representation is hierarchical in nature (tree) and is


called DOM. The root of the tree (top-level object) is the
browser window containing the page. Children of the root
node in the tree are the second-level objects, such as
paragraphs, tables, forms, etc.
DOM
Attributes of a given tag become attributes of the
respective node in the tree

A script can access and manipulate any object and its


attributes in the tree dynamically

IE and Netscape browsers are built differently inside (their


rendering engines are quite different) making similar
implementations of DOM virtually impossible.

W3C is working to standardize DOM (www.w3c.org/DOM),


but it’s not a trivial task

You might also like