最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I include a .js script in Oracle Apex? - Stack Overflow

programmeradmin4浏览0评论

I would like to make an input mask with javascript in Oracle Apex a bit prettier. How can I do that? Is there any way I can upload and embed a .js file? If so, how do you do it? Can I style whole pages with js and then upload it? I’m confused. Thank you

I would like to make an input mask with javascript in Oracle Apex a bit prettier. How can I do that? Is there any way I can upload and embed a .js file? If so, how do you do it? Can I style whole pages with js and then upload it? I’m confused. Thank you

Share Improve this question asked Apr 20, 2021 at 11:48 DaniDani 512 silver badges4 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

Step 1 open Shared Components and upload your .js script into static application files

Step 2 Upload the js script into Static Application Files and copy the reference, this reference works exactly the same as an URL

Step 3 In shared ponents open User Interface Attributes

Step 4 Paste it into Javascript / File URLS

Your script .js will be available in all your app, also you can add .css files in Cascading Style Sheets option

You can upload files to use as application or workspace resources, but for most static files (images, js libraries, etc.) you will get much faster response if you serve them from a separate web server and just put the links in your APEX code. For example, if you are using Apache HTTP or nginx as a reverse proxy for APEX you can serve them from there.

Select a page.

Click Edit Attributes.

Scroll down to HTML Header.

Enter code into HTML Header and click Apply Changes.

For example, adding the following would test a function accessible from anywhere on the current page.

<script type="text/javascript">
  function test(){
    window.alert('This is a test.');
  }
</script>

In Oracle Application Express you can reference a .js 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 .js file loads on the first page view of your application and is then cached by the browser.

The following demonstrates how to include a .js file in the header section of a page template. Note the line script src= that appears in bold.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>#TITLE#</title>
    #HEAD#
    <script src="http://myserver.myport/my_images/custom.js" type="text/javascript"></script>
</head>
<body #ONLOAD#>#FORM_OPEN#
发布评论

评论列表(0)

  1. 暂无评论