Example: Using JavaScript to build Web applications

Source: Internet
Author: User
Tags continue generator zip client microsoft frontpage
Javascript|web with the popularization of internet/intranet application, more and more users use the Client/server structure in the design and establish their own internet/intranet application. The client program is responsible for sending requests to the Web server and is responsible for accepting and interpreting the display of hypertext from the Web server. If you want to generate dynamic, interactive Web pages, you must pass the Public Gateway Interface (CGI), CGI programs can be written using perl,c++,javascript, and so on, and the current popular method is to use Java or JavaScript.
A brief introduction of JavaScript
JavaScript is a scripting language, and the advantage is that it applies both to client applications and to server-side application development. For example, at the client it can be used to write a Web browser program, while in the server it can be used to write information for processing Web browser submissions and to update the Web server program displayed by the browser accordingly. Although JavaScript can meet some of the server-side programming requirements, some server-side programs are needed to support more advanced Web applications. For example, access to a database or special processing. To this end, Netscape specializes in providing an integrated environment livewire for developing JavaScript server programs.
Ii. Introduction of Livewire
Livewire is a Web application development environment that you can use to install Netscape Fast track under a Windows NT4.0 system. Livewire can be used to develop browsers and server-side Web applications. So that the server side can replace the original CGI program needed. Livewire and Netscape servers can be downloaded from Netscape's Web site http://home.Netscape.com (30-day free trial).
Third, server-side JavaScript programming
The server-side JavaScript program is developed with livewire, and the specific programming steps are as follows:
1. Create source files in HTML embedded with client-side JavaScript and server-side JavaScript.
2, with the livewire compiler to compile the source file into a. web file.
Server-side JavaScript provides 4 objects, Request,client,project and server, to differentiate it from client-side JavaScript.
Below, we can develop some programs, first of all, in a simple example to introduce the development process:

Students. HTM provides student registration form for students to fill out.
Process.htm to deal with the number of students entered in the student. HTM registration Form
To combine client side with server-side JavaScript
To display the Student registration form and submit it to display.htm.
Display.htm shows the data collected by students. htm and process.htm, and
Stored in the Client property.
Record.htm the Student Registration form into the file student.txt.

After the procedure is attached:
Student. htm
<meta http-equiv= "Content-type"
Content= "text/html; Charset=gb_2312-80 ">
<meta name= "generator" content= "Microsoft FrontPage Express 2.0" >
<title> Student Registration </title>
<p align= "center" ><font size= "5" >welcome to computer center</font></p>
<form action= "Process.htm" >
</form>
<p><font color= "#00FF40" size= "4" > Please input the school number:</font></p>
<form method= "POST" >
<p><input type= "text" size= "name=" T1 "> <input
Type= "Submit" value= "Continue" > </p>
</form>
</body>
Process.htm
<meta http-equiv= "Content-type"
Content= "text/html; Charset=gb_2312-80 ">
<title></title>
<body bgcolor= "#808080" >
<SERVER>
<p>client.t1=request.t1
Write ("<script language=" JavaScript ">")
Write ("</SCRIPT>")
</SERVER>
</body>
</script></p>
<p align= "center" ><font color= "#FFFF00" size= "5" > Student Registration </font></p>
<form action= "Display.htm" >
Name <input type= "text" size= "name=" "Name" >

Gender <input type= "text" size= "7" name= "Sex" >

Born <input type= "text" size= "name=" Birth ">

Home addresses <input type= "text" size= "one" name= "Address" >

Postal code <input type= "text" size= "one" name= "Zip" >

Phone number <input type= "text" size= "one" name= "Tel" >

</p>
</form>
</body>
Display.htm
<meta http-equiv= "Content-type"
Content= "text/html; Charset=gb_2312-80 ">
<meta name= "generator" content= "Microsoft FrontPage Express 2.0" >
<title>client.</title>
<body bgcolor= "#FFFFFF" >
<SERVER>
<p>client. Name=request. Name
Client. Sex=request. Sex
Client. Birth=request. Birth
Client. Address=request. Address
Client. Zip=request. Zip
Client. Tel=request. Tel </p>
<p>write (client. Name+ "
")
Write (client. birth+ "
")
Write (client. Address+ "
")
Write (client. Zip+ "
")
Write (client. tel+ "
")
</SERVER> </p>
<form action= "Finish.htm" >
<p><input type= "Submit" value= "continue" > </p>
</form>
</body>

Record.htm
<meta http-equiv= "Content-type"
Content= "text/html; Charset=gb_2312-80 ">
<meta name= "generator" content= "Microsoft FrontPage Express 2.0" >
<title>f=</title>

<body bgcolor= "#FFFFFF" >
<SERVER>
<p>f=new file ("Student.txt")
F.open ("a")
F.writeln (client. Name)
F.writeln (client. SEX)
F.writeln (client. Birth)
F.writeln (client. Address)
F.writeln (client. ZIP)
F.writeln (client. Tel)
F.close () </p>
</SERVER></body>

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.