Nęste |
|
Server-Side JavaScript serie, Planche nr. 8 |
![]() |
Kategory-siden |
HTML, men med indlejret JavaScript
<HTML><HEAD> <SERVER> //////////////////////////////////////////////////////////////////////// /// // lw_category.html - LiveWire and Server-Side JavaScript //Implementation // // This page displays a list of categories from the CATEGORY //table. // The category names are hyperlinked and lead to a page with //associated // products from the PRODUCT table. //////////////////////////////////////////////////////////////////////// /// </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.close(); conn.commitTransaction(); conn.release(); } else { write("<p>Database connection failed"); }</SERVER></UL> </CENTER> </BODY></HTML>