1 / 16

JavaScript Demo

JavaScript Demo. Presented by … Jaisingh Sumit jain Sudhindra Taran Deep arora. JAVASCRIPT. What Is JavaScript? Core JavaScript Client- Side JavaScript Server-Side JavaScript JavaScript and Java. What Is JavaScript?.

shin
Download Presentation

JavaScript Demo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JavaScript Demo Presented by … Jaisingh Sumit jain Sudhindra Taran Deep arora

  2. JAVASCRIPT • What Is JavaScript? • Core JavaScript • Client-Side JavaScript • Server-Side JavaScript • JavaScript and Java

  3. What Is JavaScript? JavaScript is Netscape's cross-platform, object-based scripting language. Core JavaScript contains a core set of objects and a core set of language elements . Client-Side JS extends the core language by supplying objects to control a browser (Navigator or another web browser) and its Document Object Model (DOM). Server-Side JS extends the core language by supplying objects relevant to running JavaScript on server.

  4. What Is JavaScript? JavaScript lets you create • Applications that run over the Internet. • Dynamic HTML pages that process user input and maintain persistent data using special objects, files, and relational databases . • Through JavaScript's Live Connect functionality, you can let Java and JavaScript code communicate with each other • Netscape invented JavaScript, and JavaScript was first used in Netscape browsers.

  5. Core JavaScript Client-side and server-side JavaScript have the following elements in common: - • Keywords • Statement syntax and grammar • Rules for expressions, variables, and literals • Underlying object model (although client-side and server-side JavaScript have different sets of predefined objects) • Predefined objects and functions, such as such as Array, Date, and Math

  6. Client-Side JavaScript • Client-side JavaScript statements embedded in an HTML page • Mechanism:- • Browser (or client) requests page • Server sends the full page(HTML+Js) over the network to client. • Browser reads the page, displaying results of the HTML and executing Js statements as they are encountered.

  7. Client-Side JavaScript • Responds to user events such as mouse clicks, form input, and page navigation. • Without any network transmission, the embedded JavaScript checks the entered data and display a dialog box if the user enters invalid data.

  8. Server-side JavaScript • Server-side statements can connect to relational databases from different vendors, share information across users of an application, access the file system on the server, or communicate with other applications through livewire. • HTML pages with server-side JavaScript can also include client-side JavaScript. • Unlike pure client-side JavaScript pages, HTML pages that use server-side JavaScript are compiled into byte code executable files. • Live Wire enables you to create and customize server-based application.

  9. Server Side JavaScript • With Live Wire , we can create dynamic HTML pages. Basic steps are: (1) Create the source files(JS embedded in HTML or JS only) (2) Compile the source files with the Live Wire compiler to create the byte code executable .WEB file. Command line compiler: lwcomp -v -o myapp.web a.html b.html j.js

  10. Steps of Execution • The server receives the request. • The server checks with Live Wire to see if it “wants” the request. • The server turns the request over to Live Wire • Live Wire reads a predigested form of the HTML ( including JS byte codes) from a binary file. • Live Wire attaches built-in objects with the JS context • Live Wire interprets the predigested form of the page and then sends the resulting page over the to network the client.

  11. Server-side JavaScript example The "initial page" for the JavaScriptexample program <SERVER> //     project.html – Live Wire and Server-Side JavaScript Implementation //  Example applications project file.  Establishes database connections // // //shared by all users of example application. if (project.productDB == null) {    project.lock();    project.productDB = new Object();    project.productDB.pool =      new DbPool("ODBC", “<ser-name>", “user", “****", " ", 5, false);    project.unlock(); } </SERVER>

  12. Continued….. The HTML file for the JavaScript home page <HTML><HEAD> <TITLE> Live Wire and Server-Side JavaScript Home Page </TITLE> </HEAD> <BODY> <H2>List Generated Dynamically from Database Using Netscape Enterprise Server 3.0's Server-Side JavaScript and Live Wire</H2> <P>Click <A HREF=lw_category.html>here</A> to generate a list of  hyperlinks from the CATEGORY table. </P> </BODY> </HTML >

  13. Continued.. The HTML file for the JavaScript category page <HTML><HEAD> <SERVER> </SERVER> <TITLE>Categories</TITLE> </HEAD> <BODY> <P> <B>Select a Category:</B> <UL> <SERVER> if (project.productDB.pool.connected()) {   var conn = project.productDB.pool.connection("conn",60);     conn.beginTransaction();     qs = "SELECT category_id, category_name from CATEGORY";      results = conn.cursor(qs);     while (results.next()) {            write("<LI><A HREF=\"lw_product.html?category_id="+results.category_id+"\">"   +results.category_name+“ /A>\n");     }      results.close();      conn.commitTransaction();        conn.release(); } else {     write("<p>Database connection failed"); } </SERVER></UL> </CENTER> </BODY></HTML>

  14. Continued…. . The HTML file for the JavaScript product page<HTML><HEAD> <SERVER> </SERVER> <TITLE>Categories</TITLE> </HEAD> <BODY> <P> <UL> <SERVER> if (project.productDB.pool.connected()) {    var iCategoryID = request.category_id;    var conn = project.productDB.pool.connection("conn",60);    conn.beginTransaction();    qs = "SELECT product_name from PRODUCT WHERE category_id =" + iCategoryID;     results = conn.cursor(qs);    while (results.next()) {          write("<LI>"+results.product_name+"</A>\n");    }    results.close();    conn.commitTransaction();     conn.release();    } else {         write("<p>Database connection failed");} </SERVER></UL> </BODY></HTML>

  15. JavaScript and Java

  16. Thank you……

More Related