![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
Creating Applications with Mozilla-Chapter 2. Getting Started- P1
Số trang: 17
Loại file: pdf
Dung lượng: 64.58 KB
Lượt xem: 3
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tham khảo tài liệu creating applications with mozilla-chapter 2. getting started- p1, công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Creating Applications with Mozilla-Chapter 2. Getting Started- P1 Chapter 2. Getting Started- P1To help you start creating applications as quickly as possible, this chapterpresents two Hello World examples that demonstrate the beginning stagesof Mozilla application development.The first example is a simple XUL file that is loaded into the browserwindow. This example is then expanded on by adding additional features tothe XUL file, such as imported stylesheets and JavaScript functions. Thesecond Hello World example shows how to turn files like these intopackages, which are the modular, bundled sets of files that fit together tomake Mozilla applications or new modules for the Mozilla browser.These examples provide a context for discussing the development of Mozillaapplications. The first example focuses on creating and editing the basic filetypes, and the second focuses on the organization and distribution ofapplications on the Mozilla platform.2.1. Simple XUL ExampleLike all good Hello World applications, Example 2-1 shows one of thesimplest possible examples of XUL. Although it is small, it demonstratessome important aspects of XUL programming, including the use of eventhandlers to add behavior and the use of a box to lay out elements properlywithin the window. This example also provides a context for discussingmore general features of the language, such as the file format, thenamespace, and some XUL programming conventions.Example 2-1. Hello xFly Use your text editor to save the code in Example 2-1 in a file calledhello.xul and then load the file in Mozilla (you can do this by using File> Open File from the browser window and browsing to where you saved thefile). You should see a button in the upper-left corner of the browser windowthat brings up an alert box when clicked. Figure 2-1 shows an example of thealert pop-up window that appears.Figure 2-1. The first Hello xFly exampleThe next few sections describe this sample file in more detail. The coveredtopics include the file itself, the syntax of the markup, XUL namespaces, andthe basic layout of a XUL file.The xFly ExamplesThe best way to understand the possible uses of the Mozilla framework is tolook more closely at a number of various existing applications. This bookhighlights several Mozilla development projects, such as ChatZilla andJSLib, as examples of how some people have already started using MozillasXPFE technologies.Along with these applications, youll note the use of the name xFly inmany examples in this chapter and elsewhere in this book. The xFlyexamples are used throughout Chapter 2 to Chapter 6 to show how to createand package a simple Mozilla application. An installable version of thecomplete xFly application can be found at http://xfly.mozdev.org.This simple application is useful because it provides a place to startexploring the new information that you will learn about in this book. As youread more about XUL, CSS, JavaScript, and the other parts of Mozillasdevelopment framework, you can create and edit the xFly files to see howthese technologies work in practice.2.2. Basic XUL ConceptsYou have already seen many of XULs basic features at work. When youload the example in the previous example, the browser identifies it as a XULfile, parses the data, creates a new window and draws the button widget, andexecutes the function youve defined when the button is clicked.These activities are part of the basic and often transparent interactionbetween your application files and Mozilla. However, the format of yourXUL files, their syntax and namespace, the XUL layout, and the windowingsystem are all basic to successful XUL programming.2.2.1. The XUL File FormatA XUL file is a simple text file that contains proper XML syntax and has a.xul file extension. Mozilla expects to draw UI widgets when it encountersa file with a .xul extension or when it encounters the XUL namespace inother markup files that it recognizes, including HTML and XML.The MIME type registered for XUL files isapplication/vnd.mozilla.xul+xml. When editing and usingXUL files locally, you shouldnt need to worry about setting this on yourcomputer; however, sometimes you may need to set the MIME type, such aswhen you host XUL files on a server. Chapter 12 provides additionalinformation about how you can set the correct file type for your system.2.2.2. ConventionsXUL has to follow certain conventions (as does XHTML or any other XML-based file) in order to be valid. Mozilla generates an error when itencounters an invalid XUL file.The first thing required in a XUL document is the XML declaration.Any comments used to introduce your file can begin on the line after thedeclaration. Comments in XUL follow the same format used in HTML andXML, delimited by .All tag sets must be closed. Empty tags are allowed for some elements, suchas the element, that are used without nested elements or content.Note that a trailing slash at the end of the tag is required to denote an emptyelement.Another thing to remember is that XUL is case-sensitive. Closing a XUL tag with renders it invalid.These conventions ensure that the rendering engine can parse the XUL filesuccessfully and display the elements defined there. Mozilla does notvalidate XML files, such as XUL, and it does not resolve externally parsedentities, but it does check for document well-formedness.Following the XML specification, Mozilla ignores well-formed tags that itdoes not recognize, which can give your applications extra flexibility,particularly as you begin to use technologies such as XBL. But it can alsomake debugging a little more difficult, as when you create an element named and dont see why your XUL button doesnt have the typicalborders or three-dimensional style.A good practice to follow when creating XUL files is to use ...
Nội dung trích xuất từ tài liệu:
Creating Applications with Mozilla-Chapter 2. Getting Started- P1 Chapter 2. Getting Started- P1To help you start creating applications as quickly as possible, this chapterpresents two Hello World examples that demonstrate the beginning stagesof Mozilla application development.The first example is a simple XUL file that is loaded into the browserwindow. This example is then expanded on by adding additional features tothe XUL file, such as imported stylesheets and JavaScript functions. Thesecond Hello World example shows how to turn files like these intopackages, which are the modular, bundled sets of files that fit together tomake Mozilla applications or new modules for the Mozilla browser.These examples provide a context for discussing the development of Mozillaapplications. The first example focuses on creating and editing the basic filetypes, and the second focuses on the organization and distribution ofapplications on the Mozilla platform.2.1. Simple XUL ExampleLike all good Hello World applications, Example 2-1 shows one of thesimplest possible examples of XUL. Although it is small, it demonstratessome important aspects of XUL programming, including the use of eventhandlers to add behavior and the use of a box to lay out elements properlywithin the window. This example also provides a context for discussingmore general features of the language, such as the file format, thenamespace, and some XUL programming conventions.Example 2-1. Hello xFly Use your text editor to save the code in Example 2-1 in a file calledhello.xul and then load the file in Mozilla (you can do this by using File> Open File from the browser window and browsing to where you saved thefile). You should see a button in the upper-left corner of the browser windowthat brings up an alert box when clicked. Figure 2-1 shows an example of thealert pop-up window that appears.Figure 2-1. The first Hello xFly exampleThe next few sections describe this sample file in more detail. The coveredtopics include the file itself, the syntax of the markup, XUL namespaces, andthe basic layout of a XUL file.The xFly ExamplesThe best way to understand the possible uses of the Mozilla framework is tolook more closely at a number of various existing applications. This bookhighlights several Mozilla development projects, such as ChatZilla andJSLib, as examples of how some people have already started using MozillasXPFE technologies.Along with these applications, youll note the use of the name xFly inmany examples in this chapter and elsewhere in this book. The xFlyexamples are used throughout Chapter 2 to Chapter 6 to show how to createand package a simple Mozilla application. An installable version of thecomplete xFly application can be found at http://xfly.mozdev.org.This simple application is useful because it provides a place to startexploring the new information that you will learn about in this book. As youread more about XUL, CSS, JavaScript, and the other parts of Mozillasdevelopment framework, you can create and edit the xFly files to see howthese technologies work in practice.2.2. Basic XUL ConceptsYou have already seen many of XULs basic features at work. When youload the example in the previous example, the browser identifies it as a XULfile, parses the data, creates a new window and draws the button widget, andexecutes the function youve defined when the button is clicked.These activities are part of the basic and often transparent interactionbetween your application files and Mozilla. However, the format of yourXUL files, their syntax and namespace, the XUL layout, and the windowingsystem are all basic to successful XUL programming.2.2.1. The XUL File FormatA XUL file is a simple text file that contains proper XML syntax and has a.xul file extension. Mozilla expects to draw UI widgets when it encountersa file with a .xul extension or when it encounters the XUL namespace inother markup files that it recognizes, including HTML and XML.The MIME type registered for XUL files isapplication/vnd.mozilla.xul+xml. When editing and usingXUL files locally, you shouldnt need to worry about setting this on yourcomputer; however, sometimes you may need to set the MIME type, such aswhen you host XUL files on a server. Chapter 12 provides additionalinformation about how you can set the correct file type for your system.2.2.2. ConventionsXUL has to follow certain conventions (as does XHTML or any other XML-based file) in order to be valid. Mozilla generates an error when itencounters an invalid XUL file.The first thing required in a XUL document is the XML declaration.Any comments used to introduce your file can begin on the line after thedeclaration. Comments in XUL follow the same format used in HTML andXML, delimited by .All tag sets must be closed. Empty tags are allowed for some elements, suchas the element, that are used without nested elements or content.Note that a trailing slash at the end of the tag is required to denote an emptyelement.Another thing to remember is that XUL is case-sensitive. Closing a XUL tag with renders it invalid.These conventions ensure that the rendering engine can parse the XUL filesuccessfully and display the elements defined there. Mozilla does notvalidate XML files, such as XUL, and it does not resolve externally parsedentities, but it does check for document well-formedness.Following the XML specification, Mozilla ignores well-formed tags that itdoes not recognize, which can give your applications extra flexibility,particularly as you begin to use technologies such as XBL. But it can alsomake debugging a little more difficult, as when you create an element named and dont see why your XUL button doesnt have the typicalborders or three-dimensional style.A good practice to follow when creating XUL files is to use ...
Tìm kiếm theo từ khóa liên quan:
thủ thuật máy tính công nghệ thông tin tin học quản trị mạng computer networkTài liệu liên quan:
-
52 trang 436 1 0
-
24 trang 363 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 324 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 316 0 0 -
74 trang 305 0 0
-
96 trang 301 0 0
-
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 294 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 288 0 0 -
EBay - Internet và câu chuyện thần kỳ: Phần 1
143 trang 277 0 0 -
Tài liệu hướng dẫn sử dụng thư điện tử tài nguyên và môi trường
72 trang 271 0 0