chap17_6.html
来自「Oracle资料大集合」· HTML 代码 · 共 397 行 · 第 1/2 页
HTML
397 行
</tr><tr><td colspan="2"><img src="../../../images/dotclear.gif" width=6 height=12 alt="" border="0"></td></tr><tr><td><img src="../../../images/arrow.gif" width=10 height=17 alt="" border="0"></td><td><a href="http://www.itlibrary.com/reference/dir.groupwareandcollaboration1.html"><font face="verdana,helvetica" size="1" color="000000"><b>Groupware & Collaboration</b></font></td></tr><tr><td colspan="2"><img src="../../../images/dotclear.gif" width=6 height=12 alt="" border="0"></td></tr><tr><td><img src="../../../images/arrow.gif" width=10 height=17 alt="" border="0"></td><td><a href="http://www.itlibrary.com/reference/dir.contentmanagement.html"><font face="verdana,helvetica" size="1" color="000000"><b>Content Management</b></font></td></tr><tr><td colspan="2"><img src="../../../images/dotclear.gif" width=6 height=12 alt="" border="0"></td></tr><tr><td><img src="../../../images/arrow.gif" width=10 height=17 alt="" border="0"></td><td><a href="http://www.itlibrary.com/reference/dir.productivityapplications1.html"><font face="verdana,helvetica" size="1" color="000000"><b>Productivity Applications</b></font></td></tr><tr><td colspan="2"><img src="../../../images/dotclear.gif" width=6 height=12 alt="" border="0"></td></tr><tr><td><img src="../../../images/arrow.gif" width=10 height=17 alt="" border="0"></td><td><a href="http://www.itlibrary.com/reference/dir.hardware1.html"><font face="verdana,helvetica" size="1" color="000000"><b>Hardware</b></font></td></tr><tr><td colspan="2"><img src="../../../images/dotclear.gif" width=6 height=12 alt="" border="0"></td></tr><tr><td><img src="../../../images/arrow.gif" width=10 height=17 alt="" border="0"></td><td><a href="http://www.itlibrary.com/reference/dir.funandgames1.html"><font face="verdana,helvetica" size="1" color="000000"><b>Fun & Games</b></font></td></tr></table><!-- <IMG SRC="/images/leftnav.gif" WIDTH=111 HEIGHT=404 ALT="nav" border="0" ISMAP USEMAP="#leftnav"> --><p><a href="http://www.earthweb.com/jobs/" target=new><IMG SRC="../../../images/dice-105x30.gif" WIDTH=105 HEIGHT=30 ALT="EarthWeb Direct" border="0"></a><a href="http://www.earthwebdirect.com/" target=new><IMG SRC="../../../images/earthwebdirect.gif" WIDTH=105 HEIGHT=30 ALT="EarthWeb Direct" border="0"></a><a href="http://www.fatbrain.com/home.html?from=UUX592" target=new><IMG SRC="../../../images/fatbrain.gif" WIDTH=105 HEIGHT=30 ALT="Fatbrain" border="0"></a><a href="http://auctions.earthweb.com" target=new><IMG SRC="../../../images/auctions_105x30.gif" WIDTH=105 HEIGHT=30 ALT="Auctions" border="0"></a><a href="http://www.supportsource.com" target=new><IMG SRC="../../../images/ss2000sneak2.gif" WIDTH=105 HEIGHT=30 ALT="Support Source Answers" border="0"></a><P><b><font face="verdana,helvetica" size="2">EarthWeb sites</FONT></b><br> <FONT SIZE="1"> <a href="http://www.crossnodes.com"><font face="verdana,helvetica" size="1" color="000000">Crossnodes</font></a><br> <a href="http://www.datamation.com"><font face="verdana,helvetica" size="1" color="000000">Datamation</font></a><br> <a href="http://www.developer.com"><font face="verdana,helvetica" size="1" color="000000">Developer.com</FONT></A><br> <a href="http://www.dice.com"><font face="verdana,helvetica" size="1" color="000000">DICE</font></a><br> <a href="http://www.earthweb.com"><font face="verdana,helvetica" size="1" color="000000">EarthWeb.com</font></a><br> <a href="http://www.earthwebdirect.com"><font face="verdana,helvetica" size="1" color="000000">EarthWeb Direct</font></a><br> <a href="http://www.erphub.com"><font face="verdana,helvetica" size="1" color="000000">ERP Hub</font></a><br> <a href="http://www.gamelan.com"><font face="verdana,helvetica" size="1" color="000000">Gamelan</font></a><br> <a href="http://www.gocertify.com"><font face="verdana,helvetica" size="1" color="000000">GoCertify.com</font></a><br> <a href="http://www.htmlgoodies.com"><font face="verdana,helvetica" size="1" color="000000">HTMLGoodies</font></a><br> <a href="http://www.intranetjournal.com"><font face="verdana,helvetica" size="1" color="000000">Intranet Journal</font></a><br> <a href="http://www.itknowledge.com"><font face="verdana,helvetica" size="1" color="000000">IT Knowledge</font></a><br> <a href="http://www.itlibrary.com"><font face="verdana,helvetica" size="1" color="000000">IT Library</font></a><br> <a href="http://www.javagoodies.com"><font face="verdana,helvetica" size="1" color="000000">JavaGoodies</font></a><br> <a href="http://www.jars.com"><font face="verdana,helvetica" size="1" color="000000">JARS</font></a><br> <a href="http://www.javascripts.com"><font face="verdana,helvetica" size="1" color="000000">JavaScripts.com</font></a><br> <a href="http://www.opensourceit.com"><font face="verdana,helvetica" size="1" color="000000">open source IT</font></a><br> <a href="http://www.roadcoders.com"><font face="verdana,helvetica" size="1" color="000000">RoadCoders</font></a><br> <a href="http://www.Y2Kinfo.com"><font face="verdana,helvetica" size="1" color="000000">Y2K Info</font></a></FONT></td><!--End Left Navigation column --><!-- spacer column --><TD width="40"><img src="../../../images/dotclear.gif" WIDTH="40" HEIGHT="1" border=0></TD><!--Begin Content Column --><TD VALIGN="TOP" width="500"><P><blockquote><p><b><font size="+1">17.6 How do I匲se JavaScript to handle events?</font></b><p><B>Problem</B><p>Whenever there is a change to a form field, I want to trigger a JavaScript handler embedded in the generated HTML to handle that event. Since I need to use frames to create powerful web applications, I also need the ability to control the HTML in one frame by using JavaScript event handlers in another frame. How do I use JavaScript to handle events?<p><B>Technique</B><p>JavaScript is a scripting language developed by Netscape to enable web authors to design interactive sites. Although it shares many of the features and structures of the Java language, it was developed independently. JavaScript can interact with HTML source code to spice up sites with dynamic content. Note that JavaScript can be used if you are using Netscape Navigator browser. JScript is Microsoft抯 version of JavaScript, which is built into the Microsoft Internet Explorer (MSIE) browser. Microsoft supports only a subset of JavaScript, which it calls JScript. Unfortunately, Netscape抯 JavaScript and JScript are not entirely compatible. In order to use JavaScript for event handling, you must first understand how PL/SQL, JavaScript, and HTML interact:<p>The application calls functions and procedures in the PL/SQL Web Toolkit to generate dynamic HTML.<p>The application also embeds JavaScript code into the generated HTML.<p>In the generated HTML, form fields have event handlers that invoke JavaScript functions embedded in HTML.<p>PL/SQL variables can be passed to JavaScript directly or through the event handler.<p>JavaScript has direct access to HTML form fields that can be referenced using objects.<p>JavaScript can invoke a PL/SQL procedure using dynamic URLs, that can be targeted into the current window, new window, visible, or hidden frame.<p>JavaScript functions and built-in methods can be used in HTML hyperlinks as javascript:function_name().<p>JavaScript can also be used to generate dynamic HTML.<p>Frames divide web pages into multiple, scrollable regions enabling information to be presented in a more flexible and useful fashion. Each region has a separate page, allowing the display of multiple web pages within one page. One frame can refer to another frame by using JavaScript, allowing one frame to be updated by clicking a link in another. Frames, when used properly, can improve navigability considerably. Currently, frames are well supported by Netscape Navigator 4 and MSIE 4. The procedures in the HTP package used to generate frame tags are listed in Table 17.7.<p>Table 17.7 Procedures for frame tags<p><TABLE cellpadding=3 cellspacing=3 border=0 bgcolor="cdcdcd"><TR><td>Procedure</td><td>Description</td></TR><TR><td>htp.framesetOpen</td><td>Prints an HTML tag to open a container of frames.</td></TR><TR><td>htp.framesetClose</td><td>Prints an HTML tag to close a container of frames.</td></TR><TR><td>htp.frame</td><td>Prints a tag that defines a single frame in the frameset.</td> </TR><TR><td>htp.noframesOpen</td><td>Prints a tag to display text in a browser incapable of frames.</td></TR><TR><td>htp.noframesClose</td><td>Closing tag for a browser incapable of frames.</td></TR></TABLE><p><B>Steps</B><p><B>1.</B> Run SQL*Plus and connect as the WAITE account. If you have not created the DEPT17 table from How-To 17.2, then run CHP17_1.SQL, shown in <A HREF="image/17oht31.gif" TARGET="_blank">Figure 17.31</A>, which creates the DEPT17 table used in this How-To.<p><code><b>SQL> START CHP17_1<p>Table created.<p>1 row created.<p>1 row created.<p>1 row created.<p>1 row created.</b></code><p><B>2.</B> Run the CHP17_14.SQL file in SQL*Plus, as shown in <A HREF="image/17oht32.gif" TARGET="_blank">Figure 17.32</A>. The procedure divides the web page into two frames and directs a separate URL to each frame.<p>A frameset is opened in line 5 by calling the HTP.FRAMESETOPEN procedure and closed in line 8 with the HTP.FRAMESETCLOSE procedure. Lines 6 and 7 use the HTP.FRAME procedure to create two frames within the frameset. The OWA_UTIL.GET_OWA_SERVICE_PATH function returns the partial URL containing the name of the PL/SQL Agent and the virtual path. The second parameter to HTP.FRAME gives a name to the frame created so that it can be referenced in JavaScript. The form is an example of using HTML frames to create a scrolling select frame on the right that has buttons to select items from a list to populate the non-scrolling edit frame. This technique allows for intelligent navigation.<p>Another use of frames is to have a table of contents that can remain fixed in one frame while the content frame is updated. Frames work well with JavaScript because they offer more control that can be used to update multiple frames with one click, and create sophisticated, interactive interfaces.<p><B>3.</B> Run the CHP17_15.SQL file in SQL*Plus. The procedure is used to generate dynamic HTML for the first frame.<p><code><b>SQL> START CHP17_15<p>SQL> CREATE OR REPLACE PROCEDURE MENU17 AS<p>2 BEGIN<p>3 HTP.HTMLOPEN;<p>4 HTP.SCRIPT(慺unction checkNum(inObj)<p>5 {<p>6 inStr = inObj.value<p>7 for(var i = 0; i < inStr.length; i++) {<p>8 if (inStr.charAt(i) <
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?