Where to put javascript files.

I am working in Apex 4.0.
I have found javascript code titled accounting.js. It is available at http://josscrowcroft.github.com/accounting.js/
The instruction on use of the code are as follows:
"Download the script and put it somewhere, then do this:
<script src="path/to/accounting.js"></script>
<script type="text/javascript">
     // You can do this now:
     accounting.formatMoney(5318008);
</script>"
The accounting.js file is over 30,000 characters. Where do I put it so that I can reference it from any page in my application?
Then what do I need to do on a page where I want to use it?

You have two options. Both involve modifying your page template to include the file, but you have options on where to place the file.
1) Place it in the images folder in your application server, and refer to it using the IMAGE_PREFIX substitution string
<script src="#IMAGE_PREFIX#accounting.js" type="text/javascript"></script>2) Upload it into your Apex repository as a workspace file (Shared Components -> Static Files) and access it from the database.
<script src="#WORKSPACE_IMAGES#accounting.js" type="text/javascript"></script>Scott

Similar Messages

  • Where to put javascript file?

    I currently have my javascript file in 'ViewController\public_html' of my project. Do I have to specify the entire file path to see the iuid.js file?
    <script src="iuid.js"></script>
    <script language="JavaScript">
    Thanks

    Assuming you are using adf faces, we have something like the following structure for our js files:
    ViewController\public_html\js
    the corresponding script files will be included by inserting the following code after <afh:html> start tag:
    <afh:script source="/js/myJSfile.js"/>

  • How do I get Firefox to ask me where to put a file I wish to download

    When I download a file, Firefox puts it somewhere. I want to be able to tell it where to put that file each and every time.

    Options > General - Downloads = '''Always ask me where to save files'''

  • Where to put javascript code?

    Hello,
    I am trying to set some columns in a list as "read-only" and is using the following code:
    <script type=”text/javascript”>
    function SetReadOnly()
    var elements=document.getElementById(’4_ctl00_ctl00_TextField’);
    elements.readOnly=true;
    _spBodyOnLoadFunctionNames.push(“SetReadOnly()”);
    </script>
    But I am not sure where to put the code in. Should I put it in the space in Content Editor Web Part,
    or through a link to a txt file, or in "Edit HTML"? I've tried them but none works.
    Thanks a lot!
    Patrick

    You can try this:
    1) Open your Sharepoint List. Go to List edit view.
    2) On right side of Ribbon you will find "Form Web Parts" option as shown in figure.
    3) Choose your List form which you want to edit.
    4) Now you can add web part in new window.
    5) Add Content Editor Web part.
    6) In content editor web part add the path of your "txt" file in which you have written your script, for eg.
    <!DOCTYPE html>
    <html>
    <body>
    <script type=”text/javascript”>
    function SetReadOnly()
    var elements=document.getElementById('4_ctl00_ctl00_TextField');
    elements.readOnly=true;
    _spBodyOnLoadFunctionNames.push("SetReadOnly()");
    </script>
    </body>
    </html>
    I haven't tried this method so I am not sure but hope it works...:D
    ***If my post is answer for your query please mark as answer***
    ***If my answer is helpful please vote***

  • Where to put javascript as global function

    Hi,
    Most of threads i read (which have simple javascript codes), the codes are written in 'HTML HEADER' on each pages and later can be call by items or else. If i have the same javascript but is used by many pages, so far my understanding is i have to duplicate the code on each pages. So my question is, where can i write the javascript in apex so it can be called by many pages ? ('Global' function).
    Thanks
    Gamez

    Hello,
    It looks like your confusing a couple concepts.
    Oh i see, i thought theres something like 'Application Process' where people can put some code inside.If your build AJAX functionality the easiest way to do it in APEX is using PL/SQL code in Application OnDemand Process.
    Andy, since i also totally new in java, what SIMPLE tool to use for compiling the script ? (need to compile?).In APEX you don't use java you use javascript and you don't need a compiler. Since your just starting out with javascript you should spend an hour or two at this site [http://www.w3schools.com/JS/default.asp]. It will save you countless hours in the future and is applicable in any web development environment.
    Martin, i'v created Page 0, but i dont see any place to put the javascript inside the page. Theres no kinds of HTML Header/Footer/Body where i can put it.So to your main question what is the best place to put a global javascript. There are four answers and I will put them in order from best to worse.
    1. In an external javascript file included in you page template between the head tags.
    2. In an external javascript file included in Page 0, put it in a HTML Region with No Template in the After Header region position.
    3. In an inline script section in the page template between the head tags.
    4. In an inline script section in the page template between the head tags in Page 0, put it in a HTML Region with No Template in the After Header region position.
    PS. I'm not kidding about the w3schools link it will save you hours!
    Regards,
    Carl

  • Where to put jar files reachable for ejb:s?

    Hello!
    I have a ejb that use some jar files.
    But I can not figure out where to put the jar files that I use from my ejb in Weblogic 8.1.3.
    Until now I have extracted all jar files and put them inside my ejb with my own class files. But this seems odd.
    So please help me out here.
    Best regrads
    Fredrik

    Dear,
    You might have downloaded either tar.gz or zip file. when you extract this file you will find a jar file and also some demos nad docs(api+help). place the poifs api jar file in 'WEB-INF\lib" folder and restart the server.
    In general any api jar files for web applications should be placed in WEB-INF\lib folder then only they are accesible. If you extracted the jar, then place entire package structure in WEB-INF\classes directory
    Regards,
    Nishant Kulkarni
    Software Engineer
    Bangalore
    [email protected]

  • Where to put property files used by XSLT extensions?

    Still fighting with Java XSLT extensions. I have narrowed the
    problem down: my XSLT extension cannot find its property file,
    which I use to store JDBC connect strings etc.
    What is the proper directory to put this file so the XSLT
    extension class can find it? I am using Oracle HTTP Server with
    XDK 9.0.

    Thanks for the answer, Steve!
    Depends on what call you're using in your extension function to
    read your properties.Maybe I tried a too simplistic approach. I'm just using this:
    Properties props = new Properties();
    try {
    props.load(new FileInputStream("/foo.properties"));
    etc.
    This (with the slash) works if the properties file is in the root
    directory of the filesystem, but it's a kludge.
    If you read your properties as a resource using
    getResourceAsStream(), then where the classloader expects to
    find your file depends on the resource name that you specify.So maybe I should use getResourceAsStream() then? What if I put
    the properties file inside the JAR with the extension classes?
    Or is there any way to reference the web root?
    --Jere

  • Where to put javascript?

    Following suggestions on this forum I put some javascript functions in the header part of my theme. This somehow doesn't seem right.
    1) Once you switch theme your app. stops working.
    2) Themes should be about the look of your app. and not about the functioning of it.
    So, what is a good place to put it?
    thanks Rene

    But where do I put javascript functions that I want to use on more than 1 page?

  • Where to put .txt file with SimpleInput

    Hello everyone,
    I'm rather new to Java and have a slight problem. The thing is that I need to write an app that can read a text file in this format:
    2
    Orc
    name = Gnorck
    experience = 20
    maxHealthPoints = 50
    healthPoints = 30
    maxBerserk = 9
    berserk = 7
    Human
    name = Aragorn
    experience = 45
    maxHealthPoints = 40
    healthPoints = 30
    maxGreed = 20
    greed = 10
    The first number is de number of characters in the file and after that every character is described in 7 lines.
    Now the application has to be able to read the file. I've choosen to first just make a list of characters. A friend helped me with this code but I'm not completely sure if I know how it works. The code:
    package RPGApplicatie;
    import java.util.*;
    public class Karakters {
         //Constructor
         public Karakters(int size){
              karakters = new ArrayList(size);
         //Methode voor het toevoegen van een karakter
         public void voegToe(Karakter k){
              karakters.add(k);
         public static Karakters readFile(String filename) throws ClassNotFoundException, RuntimeException, InstantiationException, IllegalAccessException{
              SimpleInput file = new SimpleInput(filename);
              int size = file.nextInt();
              Karakters result = new Karakters(size);
              for(int i = 0; i < size ; i++) {
                   Class c = Class.forName(file.nextLine());
                   result.voegToe((Karakter)c.newInstance());
              return result;
         //Variabelen aanmaken
         private ArrayList<Karakter> karakters;
    }First question: I have the classes Karakter (which is the superclass for class Human and Orc), Human and Orc. So does the method forName scan for strings that are also classes? Like so it scans the file and when it comes across a line that says either 'Orc' or 'Human' it adds it to the list?
    Second question: Where to put the text file that holds the data? I now have it in the same folder called test.txt. I use this code to run it:
    package RPGApplicatie;
    public class RPGApplicatie {
         public static void main(String[] args) throws ClassNotFoundException, RuntimeException, InstantiationException, IllegalAccessException {
              Karakters.readFile("test.txt");
    }Thanks in advance! If more info is needed I can post that.
    Regards,
    Sander

    I assume you have defined your Human and Orc classes to include fields name, experience, etc and a constructor that takes these values as parameters?
    You can remove the Class.forName() method altogether. Example:
    int count = file.readInt();
    // define variables for Karakter values (name, experience etc.)
    for (int i = 0; i < count; i++)
      String characterClass = file.readLine();
      // read common character components
      if (characterClass.equals("Human")
        // read human specific components
        karakters.add(new Human(...));
      if (characterClass.equals("Orc")
        // create Orc
    //...Cheers

  • Where to put Jar file?

    Hello,
    We are running the J2EE installation of ColdFusion, and I'm
    wanting to find out, is there a place on the server where I can add
    replace Jar files without restarting the JRun service?
    Thanks.

    lok2005 wrote:
    > Hello,
    >
    > We are running the J2EE installation of ColdFusion, and
    I'm wanting to find
    > out, is there a place on the server where I can add
    replace Jar files without
    > restarting the JRun service?
    >
    > Thanks.
    >
    Yep, depending on your installation type (stand-alone or
    multi-instance)
    you can put jar files in the lib directory of the JRun server
    and
    they'll get picked up without a restart. In the
    multi-instance
    installation this directory is {JRunRoot}\servers\lib, so on
    a typical
    Windows box this would be C:\JRun4\servers\lib. For a
    standalone
    installation it would be C:\CFusionMX7\lib
    Hope that helps,
    Matt
    Matt Woodward
    [email protected]
    Adobe Community Expert - ColdFusion

  • Where to put .txt file for easy I/O

    Hi,
    I'm creating a program to run psychological experiments, and I want to make it easy for future researchers to change the lists of stimuli.
    I'm planning on having a set of .txt/.csv files containing the lists, which can be easily modified by anyone. My question is, where do I put them?
    My guess is the easiest solution would be to put them in the same folder as the .jar file, but not to actually include them in the .jar file, as this would make it difficult to edit. So how would I refer to the path name of the list in my program? And, when testing the program as it's being written, should I put the files in the /dist folder that NetBeans created?
    Second question: I want to find and load any and all txt files that may be in the folder (assuming this is where they will go). I won't know ahead of time how many lists there will be. What's the easiest way to do this?
    Thanks!

    Alright, two questions:
    1) To find the files, can I just use some modified form of
    String[] filenames;
              File f = new File(".");
              filenames = f.list();I assume that there's some way of doing the same thing one level up on the directory tree, and then selecting only those files that end in .csv? Is it preferable to use the method that was mentioned above?
    2) I'm still a little confused as to where the files should go. Here in NetBeans, when I use the command above it gives me everything in the very bottom folder, including /dist, /src and everything else in that folder, even though the .jar file itself is located in /dist.
    Is NetBeans not actually running the program from the .jar file?
    When I distribute the code, should I assume that the "File f = new File(".");" will give me everything in the folder where the .jar is sitting?
    [Edit: I've solved #2 myself -- sorry about that. The answer seems to be "yes" and "yes": when testing, I should put my .csv files in the bottom folder, when distributing, I should put them in the folder with the .jar file. I can't do it ahead of time, as NetBeans recreates the /dist folder each time the project is re-built.]
    Thanks!

  • Where to put props file

    Hello,
              when using a WAR application to deploy a servlet, which uses a
              ResourceBundle to read a properties file, where should the properties file
              be put in the .war directory structure.....I put it in WEB-INF/lib, but that
              does not work....
              regards,
              Farhat
              

    I have a similar question - I'm not using Resource Bundles, but I want to be
              able to set some properties, from my program/servlet/jsp. If I include it in
              the WAR file, I can't set them. Where is a recommended spot for properties
              files to live?
              -Ketan
              Charlie Crook <[email protected]> wrote in message
              news:3a702ec4$[email protected]..
              > The properties file has to be available to the jvm - hence in the
              classpath.
              > But if the properties file is only as an .ini replacment by that
              particular
              > servlet, why not just move all the information from the properties into
              some
              > init parms for the servlet - in web.xml?
              >
              > "Muhammad Farhat Kaleem" <[email protected]> wrote in message
              > news:3a6fe9d7$[email protected]..
              > > Hello,
              > > when using a WAR application to deploy a servlet, which uses a
              > > ResourceBundle to read a properties file, where should the properties
              file
              > > be put in the .war directory structure.....I put it in WEB-INF/lib, but
              > that
              > > does not work....
              > >
              > > regards,
              > > --
              > > Farhat
              > >
              > >
              > >
              > >
              >
              >
              

  • Where to put inf File so Servlets can read it?

    Hi
    I have a .inf file that contains the location of a database and of my smtp server. I have some servlets that make calls to java classes that read this file in order to access a DB and send emails etc. Where should i put this file so that when i come to run my project on apache the servlets and java classes can see and use the inf file? Do i need to put it in the WEB-INF directory etc? Do i need to add anything to the Web.xml file etc?
    Thanks
    David

    Thanks, ive set it up so it now uses a properties file which is placed in the same package as the class file on apache. But in order to read the file i need to put an absolute path in e.g.
    Properties props = new Properties();
    props.load(new FileInputStream("C:/apache-tomcat-6.0.10/webapps/ROOT/WEB-INF/classes/coreservlets/message.properties"));
    however i want to use a relative path, somethin like:
    props.load(new FileInputStream("/message.properties"));
    but this does not seem to work, do i need to define a realtive path using different syntax or do i need to place the properties file in a different place or change some configuration settings in apache?
    Thanks
    David

  • Where to put Jsp File?

    Hi!
    I am using Apache-tomcat web sever. To run my
    jsp progam where to put my jsp file?
    Thanks.

    Hi
    you can place your jsp file in webapps/ROOT/ directory.

  • Where to put ASE files

    Once I download the ase files I can't quite figure out where
    to put them so that when I'm using Photoshop or Illustrator or any
    Adobe application they will show up as option for me to select from
    in the swatches palette. Any advice would be appreciated.
    Thanks!

    Thanks for the tip. It was helpful. By doing that I realized
    that I could store the .ase files in the same place Adobe
    Photoshop, Illustrator, In Design, and Go Live currently store the
    swatches.
    I have CS2, and this is where I found the current storage of
    swatches.
    C Drive > Program Files > Adobe > Adobe Photoshop
    CS2 (or Illustrator, In Design, Go Live) > Presets > Color
    Swatches/Swatch Library/Swatches (depending on the app)
    Then I tested each out in that particular application and
    they worked beautifully. The only thing that stinks is that you
    have to put the .ase file in each Swatch folder for each one of the
    applications so in my case that was 4 times. I guess you could keep
    them in one central place and then access them from all
    applications.

Maybe you are looking for

  • Drag and drop to CDRW - Leopard 10.5.4

    Is there a reliable application, preferrably a free download, that will give drag and drop capability to a CDRW? I'm relatively new to Mac (I'll never go back to Windows!!!), so I could also be missing something. Any suggestions are appreciated!!

  • Color labels: I never see 'em; not color blind too

    I set color labels for clips, and there is no indication whatsoever on the clip thumbs or in the source panel or anywhere. I see nothing you could call a label or color label.  Presumable the labels are for easy locating? 

  • DC-In Board failure

    Rhonda, Can you send me a link to that place where you can get the DC-In board replaced? Thanks. Eric

  • MB1A Problem - Available Quantity show 9,999,999,999

    Hello, Guru My company work on SAP ECC6.0, I'm about to do good issue but I struck on some problem. I have one material which is control in batch management and now I want to issue this material thru T-code MB1A, Mvt = 261, but while I trying to choo

  • JSF 2.0 - Validators

    Do JSF 2.0 Validators get fired if the input is null?