Articles Tagged 'DOM'

The logical rule in CSS

A characteristic of the style sheets that few know and use is the ability to define the rule of "competition" of classes! A tag, in fact, may possess one or more associated classes, which makes the latter extremely versatile, as well as my favorite. How many developers use to do, I tend to attach to ID a few CSS rules, if any. Ideally, logically, would enter the ID only for scripting purposes, because it uniquely identifies an element within the DOM.

More ...

jQuery snippets

Verify the existence of an element in the DOM

It would happen that it must establish the existence of an element of the DOM. With jQuery could be spontaneously try:

More ...

Accessibility and Usability: unobtrusive Javascript

Allowing users to interact with a Web page in recent years has produced a significant increase in the use of client-side scripting: Javascript code can respond in real time and manipulate a variety of information. The Web2.0 is the ultimate expression of this capacity for interaction, in which the end user - the user-to participate actively in the construction and 'evolution of the Web site, interacting with it and helping yourself. Is referred to as User-Generated Content (or UGC - user generated content) that sees the "navigator" definitely not passive!

To achieve this interaction, thus allowing the end user to add his contribution, we developed a series of techniques that have changed the appearance and behavior of Web pages (static until now, but now similar to the traditional applications of Desktop) in recent years. Change the content of a page, send files, giving their vote to a video or a document, register or change their personal data, are just some of the adaptions operations in many services (2.0 beta) on the Web

More ...

Adobe Apollo Alpha Release

Adobe has finally released the alpha version of Apollo . We are still far from the final version, but you can check out some of its functionality due to Demo applications (. air) proposals online. The installation ( Apollo runtime ) of this Alpha weighs about 6Mb - for Windows. The Demo (Apollo sample applications) do not come to weigh even 600Kb. After installing the Apollo runtime will seem nothing changed on your PC (not added any links on the desktop or taskbar), even though you have installed - in fact - the new browser from Adobe! See Web2.0: Adobe is trying to Apollo?

More ...

Where JavaScript wins

Choose the technology to use in developing a Web Application is of vital importance, not to find himself in trouble soon after. The type of web application, its operational characteristics, are the first point to be taken into account to choose the FrameWork and related technologies.
I have often discussed the effectiveness of JavaScript script against different technologies like Adobe Flash or Java. However, it is important to emphasize an important aspect often overlooked: access to the DOM. Javascript, in this case, the candidate (if not the only one) a favorite for this type of operation.

Tools with Snap , for example, operate on a simple mechanism: when the HTML page is loaded (and after introduction of the loading of JavaScript scripts) is to scan the page and added a new HTML code at special points. In the case of Snap identifies all links to external pages (or in the internal configuration of the last issue), the TAG <A> for indenderci. These are modified so that on mouse to open a dialog anterpima of links (see this very blog for an example).

Not only snap but many other JavaScript scripts basically do the same thing. Lately, this technique is widely used by the library Prototype , which provides a variety of methods (such as the famous double-dollar, or $ $ $ - see Prototype: the use of the double dollar sign ($ $) ) is to track that change - the fly - the elements of an HTML page.

Navigating through the HTML DOM is therefore specific task of Javascript. Historically, inter alia, JavaScript was introduced in order to read and write the contents of an HTML page.
For example, if we wanted to make some changes to an HTML page using Adobe Flash, we aggorgeremmo - sooner or later - to be forced to invoke a JavaScript function. The new ActionScript 3.0, for example, provides a class ( ExternalInterface ) suitable for this purpose. – o fscommad() per chiamare una funzione Javascript: Once (in previous versions of ActionScript) we used the command getURL() - now replaced by better flash.net.navigateToURL() - or fscommad() to call a JavaScript function:

1
) ; getURL ("javascript: myFunction ()");

In addition:

The ExternalInterface class is the External API, an application programming interface That Enables straightforward communication Between ActionScript and the Flash Player container, for example, an HTML page with JavaScript, or a desktop application with Flash Player embedded.

Note that "desktop application" that so much reminds Apollo!

Today, thanks to ExternalInterface , you can invoke a JavaScript function to at least cleaner (this class allows management much more effective than getURL() , such as passing parameters):

1
2
3
4
5
6
/ * Calls the external function "addNumbers"
passing two parameters, and Assigning That function's result
to the variable "result" * /
uint = 3 ; var param1: uint = 3;
uint = 7 ; var param2: uint = 7;
uint = ExternalInterface . call ( "addNumbers" , param1 , param2 ) ; var result: uint = ExternalInterface . call ("addNumbers", param1, param2);
1
2
3
4
5
6
<Script> <! -
/ / Adds two numbers, and sends the result back to ActionScript
num1 , num2 ) { addNumbers function (num1, num2) {
num1 + num2 ) ; return (num1 + num2);
}
/ / -> </ Script>

What can we conclude then? Among the various frameworks and libraries available the initial analysis of the project you want to achieve is of paramount importance. Mistakes at this stage can seriously affect the subsequent stages of any project Web2.0. JavaScript, then, that trumps all when it needs to interact with the DOM.

More ...


Stop SOPA