 |
|
Oracle Application Express (APEX):
Calling JavaScript on Page Loading
Oracle Tips by Burleson Consulting |
Calling JavaScript on Page
Loading
The JavaScript source code shown above has a
handy function you may want to reuse – setFocus. This
function accepts a parameter of the page item name to set focus to.
The place you will call this code from is on Page Attributes page in
the On Load region. Navigate to the page attributes page for the
Java Script application page and enter the text shown in figure
X.2. Then apply changes.
%
Although the page attributes has a
property named Cursor Focus that can be set
to First item on page you may not want to set
focus to the first item on the page. For this
reason the setFocus( ) function may be the option
you will want to use.
|
You will likely need to change the name of the
page item to match the name you have. Now when the page is rendered
the focus will be placed on the Username text field.
SEE
CODE DEPOT FOR FULL SCRIPTS

Figure X.2 –
Calling JavaScript on Page Loading.
Using the Page HTML Body Attribute will modify
the <body> tag as shown here:
<body onLoad="javascript:setFocus('P4_USERNAME');">
APEX developer support:
 |
For APEX development support just call to gat an
Oracle Certified professional for all APEX development
projects. |
For more information on this topic, see the
book "Easy Oracle HTML-DB Application Express
", the best book anywhere on expert APEX
development:
 |
Easy Oracle HTML-DB Application Express
By Michael Cunningham & Kent Crotty
Only $27.95
Buy it now and get the code depot download
|
|