tailieunhanh - Creating Applications with Mozilla-Chapter 2. Getting Started- P1
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ả | Chapter 2. Getting Started- P1 To help you start creating applications as quickly as possible this chapter presents two Hello World examples that demonstrate the beginning stages of Mozilla application development. The first example is a simple XUL file that is loaded into the browser window. This example is then expanded on by adding additional features to the XUL file such as imported stylesheets and JavaScript functions. The second Hello World example shows how to turn files like these into packages which are the modular bundled sets of files that fit together to make Mozilla applications or new modules for the Mozilla browser. These examples provide a context for discussing the development of Mozilla applications. The first example focuses on creating and editing the basic file types and the second focuses on the organization and distribution of applications on the Mozilla platform. . Simple XUL Example Like all good Hello World applications Example 2-1 shows one of the simplest possible examples of XUL. Although it is small it demonstrates some important aspects of XUL programming including the use of event handlers to add behavior and the use of a box to lay out elements properly within the window. This example also provides a context for discussing more general features of the language such as the file format the namespace and some XUL programming conventions. Example 2-1. Hello xFly xml version -- Sample XUL file -- window xmlns http keymaster gatekeeper box align center button label hello xFly onclick alert Hello World box window Use your text editor to save the code in Example 2-1 in a file called 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 the file . You should see a button in the upper-left corner of the browser window that brings up an alert box when clicked. Figure 2-1 shows an example of the alert pop-up window that
đang nạp các trang xem trước