Create a development environment before making it.
Open netbeans6.1, in the project workspace, right-click the new project, and select the Web application under the Web directory.
Project name Input Riademo 。
Select the server to run and Java EE Standard.
Choose tomcat5.0,j2ee1.4 here, this article describes the example, does not depend on the server, because the html&css&javascript itself is static, after the finish is an HTML file. In the strict sense of the Web program must have a server to run, NetBeans or the use of this management philosophy.
In this step, you can already click to complete the build project, and the next step is to select the frame, here, for simplicity and purity, without selecting any frames.
After the project is established, the Project workspace project structure is as follows:
Because it's static, so there's no need to focus. Web Anything outside the page directory.
For ease of management, it is also necessary to Web Page directory to create a new two directory, Inc And Images , quite simply, here no longer repeat.
The first example, when the page requests the Wait , the effect is as shown :
This example freezes this page and displays a wait box before performing an operation on the current page, before leaving or returning the result of the operation. The function is to prompt the user, the page is loading. In particular, for certain High-volume data requests, the UI can mitigate the annoyance caused by long waits for customers.
To make a simple analysis, this example consists of 2 main points.
1 , static elements
2 , when the box appears and disappears
The UI in the effect is a loading box that is on a darkened background.
For static elements, regardless of what they appear to be, their nature is always html,css and JavaScript, of course, except for embedded controls, such as Flash, in fact, embedded controls are not within the scope of static elements such as HTML.
In this case, the box with the loading is actually just a div that contains a picture with scrolling effects and plain text, except that the div is beautified with CSS and then combined with the features of the Web page, using JavaScript to control the div display and disappear.
So, how to make this effect, in order to clearly explain the entire production process, temporarily regardless of JavaScript, first produced the Div.
In the Web page directory, right-click, new-->html
Choose Html , naming the file index
When the page is built, the material you need is a picture with scrolling effect. Loading.gif , copy the picture to Images Folder.
Next, create a new Css Files, in Inc Right click on folder, new --> Other , Select cascading Style sheets in other directories, as shown in the figure:
Name Style , click Finish, Build Css File, which is created by this step Css , a style is automatically generated Root , move the cursor to Root Within the scope of the style sheet, NetBeans will display a Css Style Builder window, along with an effect preview window, as shown in the following illustration:
The Builder window to the right of the editor provides a number of properties for the Gui Settings, and automatically generate the corresponding code, and the editor below is the style of the preview effect, for example, the author in the font panel, style selection Italic , thickness selection Bold , and then select the Underline, color selection #ff0099 ( A red one. ) , The color selector pops up when you select the color, and the preview looks like this:
The editor automatically generates the code, and the preview box also shows the effect after the application, which NetBeans It's a pretty good place to do it.
It should be explained that the tool generated by the code is simple, but certainly not their own handwriting to be flexible, good control.
Here, define the style of the waiting box we need
. Loading
{
border:2px solid #a3bad9;/*The style of the border of the applied style object*/
Color: #003366; /*The color of the content in the applied style object*/
padding:10px; /*The distance of the content in the applied style object from the style border ( Up, down, left, right ) */
margin:0; /*The distance between the applied style object and its surrounding elements ( Up, down, left, right ) */
z-index:2000; /*Of the applied style object in the Web page. Z Value of coordinates*/
width:205px; /*The width of the applied style object*/
Text-align:center; /*Center the content in the applied style object*/
Position:absolute; /*How the Applied style object is displayed in the page*/
Font-weight:bold; /*Style of the font in the applied style object*/
font-size:13px; /*The size of the font in the applied style object*/
}
The specific meaning of each attribute, if the reader is interested in looking for more information to do a deeper understanding, here do not elaborate.
Build good Css After that in the just established Index.html of the file section, add the following code to import the Css Style.
In