Dojo QuickStart Quick Start Tutorial (3) Selector

Source: Internet
Author: User
Tags html page mootools

Although so far, there is no one in the message to see the dojo, but I am still ready to continue to write, do not guarantee that you can write, perhaps the day does not want to write, or another love, may be over, hehe.

In addition, as opposed to efficiency, I prefer to organize the orderly code, MooTools is also good, as if the component library is not yet perfect.

Finally, I also learn to write, many places may have errors, I hope you find a lot of corrections.

This one to see the selector bar, in fact, the difference is not bad, you should have played jquery or MooTools, you should be able to see clearly.

Preparatory work

In this article, the Dojo Library is directly referenced from Google server, so that the machine only needs an HTML page can be run, debugging information printing with the Firefox+firebug plug-in. The entire frame is as follows, the back 1.1 points into the inside fill code:

The Dojo library is referenced directly from the Google Server, and you can also use the native hangar
<script type= "Text/javascript" src= "Http://ajax.googleapis.com/ajax/libs/dojo/1.3.1/dojo/dojo.xd.js" ></ SCR ipt>

<script type= "Text/javascript" >

Print information for an element
function Printelement (info,node) {
Console.debug (info);
Console.debug (node.innerhtml);
Console.debug ("\ n");
}
Print information for each element in an array of elements
function PrintArray (Info,arr) {
Console.debug (info);
Arr.foreach (function (node) {
Console.debug (node.innerhtml);})
Console.debug ("\ n");
}

All code is executed from here, and all functions are called from here.
Dojo.addonload (function () {

Temporarily leave blank, the code in this article is added here

});

</script>


<body>
<a id= "A1" href= "#" >a1:id=a1</a>
<a id= "A2" href= "#" >a2:id=a2</a>

<div id= "Sub_1" >
<a id= "A3" href= "#" >a3:id=a3</a>
<a class= "foo" href= "#" >a4:class=foo</a>
<a class= "foo" href= "#" >a5:class=foo</a>
<div id= "sub_2" >
<a href= "#" >a6</a>
<a class= "foo" href= "#" >a7:class=foo</a>
<a class= "foo" href= "#" >a8:class=foo</a>
</div>
</div>

</body>

The page displays the following effect in the browser

H1

H2

There are two custom functions in the script code printelement and PrintArray, which you don't care about, they just print the information and need to pay attention to the code behind it.

The Dojo.addonload () function is the entry for the entire program, which is equivalent to the main function.

There are 8 hyperlink elements and 2 H1 elements in the static page, and they are used to make a selection experiment.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.