Edit D:\app\Administrator\product\11.2.0\dbhome_1\apex\images\doc\bldapp_js_functions.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>Incorporating JavaScript Functions</title> <meta name="generator" content="Oracle DARB XHTML Converter (Mode = ohj/ohw) - Version 5.1" /> <meta name="date" content="2009-04-14T16:11:29Z" /> <meta name="robots" content="noarchive" /> <meta name="doctitle" content="Incorporating JavaScript Functions" /> <meta name="relnum" content="Release 3.2" /> <meta name="partnum" content="E11947-01" /> <link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> <link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> <link rel="contents" href="toc.htm" title="Contents" type="text/html" /> <link rel="up" href="preface.htm" title="Home" type="text/html" /> <link rel="up" href="app_comp.htm" title="Adding Application Components" type="text/html" /> <link rel="up" href="bldapp_js.htm" title="Incorporating JavaScript in..." type="text/html" /> <link rel="up" href="bldapp_js_functions.htm" title="Incorporating JavaScript Fu..." type="text/html" /> <link rel="prev" href="bldapp_js_items.htm" title="Previous" type="text/html" /> <link rel="next" href="bldapp_js_but.htm" title="Next" type="text/html" /> </head> <body> <p id="BREADCRUMBING"><a href="preface.htm" title="Home">Home</a> > <a href="app_comp.htm" title="Adding Application Components">Adding Application Components</a> > <a href="bldapp_js.htm" title="Incorporating JavaScript in...">Incorporating JavaScript in...</a> > Incorporating JavaScript Fu...</p> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr valign="bottom"> <td align="left"></td> <td align="center"><a href="bldapp_js_items.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="bldapp_js_but.htm"><img src="dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> <p><a id="CIHGHDFA" name="CIHGHDFA"></a></p> <div class="sect2"> <h1><a name="HTMDB25493" id="HTMDB25493"></a>Incorporating JavaScript Functions</h1> <p>There are two primary places to include JavaScript functions:</p> <ul> <li> <p>In the HTML Header attribute of the page</p> </li> <li> <p>In a .js file in the page template</p> </li> </ul> <div align="center"> <div class="inftblnotealso"><br /> <table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0"> <tbody> <tr> <td align="left"> <p class="notep1">See Also:</p> <a href="bldapp_cut_about.htm#CEGIDFJH">"Text with JavaScript Escaped Single Quotes"</a> for information about referencing a shortcut inside of a JavaScript literal string</td> </tr> </tbody> </table> <br /></div> <!-- class="inftblnotealso" --></div> <div class="sect3"><!-- infolevel="all" infotype="General" --><a id="sthref1310" name="sthref1310"></a> <h2><a name="HTMDB25494" id="HTMDB25494"></a>Incorporating JavaScript into the HTML Header Attribute<a id="sthref1311" name="sthref1311"></a></h2> <p>One way to include JavaScript into your application is to add it to the HTML Header attribute of the page. This is a good approach for functions that are very specific to a page and a convenient way to test a function before you include it in the <code>.js</code> file.</p> <p>You can add JavaScript functions to a page by simply entering the code into the HTML Header attribute of the Page Attributes page. In the following example, adding the code would make the <code>test</code> function accessible from anywhere on the current page.</p> <p>To add JavaScript code in the HTML Header attribute:</p> <ol> <li> <p>On the Workspace home page, click the <span class="bold">Application Builder</span> icon.</p> </li> <li> <p>Select an application.</p> </li> <li> <p>Select a page.</p> </li> <li> <p>Under Page, click the <span class="bold">Edit page attributes</span> icon.</p> </li> <li> <p>Scroll down to HTML Header.</p> </li> <li> <p>Enter code into HTML Header and click <span class="bold">Apply Changes</span>.</p> </li> </ol> <p>For example, adding the following would test a function accessible from anywhere on the current page.</p> <pre xml:space="preserve" class="oac_no_warn"> <script type="text/javascript"> function test(){ window.alert('This is a test.'); } </script> </pre> <div align="center"> <div class="inftblnotealso"><br /> <table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0"> <tbody> <tr> <td align="left"> <p class="notep1">See Also:</p> <a href="bldr_pg_att_about.htm#CHDBDJCH">"HTML Header"</a></td> </tr> </tbody> </table> <br /></div> <!-- class="inftblnotealso" --></div> </div> <!-- class="sect3" --> <div class="sect3"><!-- infolevel="all" infotype="General" --><a id="sthref1312" name="sthref1312"></a> <h2><a name="HTMDB25495" id="HTMDB25495"></a>Including JavaScript in a .js File Referenced by the Page Template<a id="sthref1313" name="sthref1313"></a><a id="sthref1314" name="sthref1314"></a></h2> <p>In Oracle Application Express, you can reference a <code>.js</code> file in the page template. This approach makes all the JavaScript in that file accessible to the application. This is the most efficient approach since a <code>.js</code> file loads on the first page view of your application and is then cached by the browser.</p> <p>The following demonstrates how to include a <code>.js</code> file in the header section of a page template. Note the line <code>script src=</code> that appears in bold.</p> <pre xml:space="preserve" class="oac_no_warn"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>#TITLE#</title> #HEAD# <span class="bold"><script src="http://myserver.myport/my_images/custom.js" type="text/javascript"></script></span> </head> <body #ONLOAD#>#FORM_OPEN# </pre> <div align="center"> <div class="inftblnotealso"><br /> <table class="NoteAlso oac_no_warn" summary="" cellpadding="3" cellspacing="0"> <tbody> <tr> <td align="left"> <p class="notep1">See Also:</p> <a href="ui_templt_page.htm#BABGJFEI">"Page Templates"</a></td> </tr> </tbody> </table> <br /></div> <!-- class="inftblnotealso" --></div> </div> <!-- class="sect3" --></div> <!-- class="sect2" --> <!-- Start Footer --> <div class="footer"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <col width="86%" /> <col width="*" /> <tr> <td align="left"><span class="copyrightlogo">Copyright © 2003, 2009, Oracle and/or its affiliates. All rights reserved.</span><br /> <a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Legal Notices</span></a></td> <td align="center"><a href="bldapp_js_items.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> <span class="icon">Previous</span></a> </td> <td align="center"><a href="bldapp_js_but.htm"><img src="dcommon/gifs/rightnav.gif" alt="Next" /><br /> <span class="icon">Next</span></a></td> </tr> </table> </div> <!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de