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?

Similar Messages

  • 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 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

  • 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 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"/>

  • Where to put js that should show on every page, like Appex have?

    In every page header there are entry like:
    <+html lang="hr" xmlns:htmldb="http://htmldb.oracle.com">
    <+head>
    <+script src="/i/javascript/htmldb_html_elements.js" type="text/javascript"></script>
    <+script src="/i/javascript/htmldb_get.js" type="text/javascript"></script>
    <+script language="JavaScript" type="text/javascript">
    <+!--
    /*Global JS Variables*/
    +var htmldb_Img_Dir = "/i/";1) I would like to know where to put some of my js to be loaded automatically on every page regardless current theme (like in above example).
    2) If I want to some js be shown on template based filter.
    What is bothering me is that i would like to put some js on every page where for instance report template is loaded...what is the best way for that?
    THX!

    Hello,
    If you only want it to load on pages with a certain template on way to do it just put the link into the footer of the template itself.
    So the end of you report template would look like
    ....&lt;/table>
    &lt;script src="/i/mystuff/my.js" type="text/javascript">&lt;/script>
    It doesn't make for the best html code but the effect is what you want without having to do any conditions or run a separate page template or do to much on a bunch of different pages.
    Carl

  • Where is the javascript?

    Hello all:
       I am just beginning to learn Javascript for Acrobat and I am having a very fundamental problem.  According to the documentation I have (for an older version of Acrobat, for which I apologize) I am told that Javascripts outside a PDF should be placed in the "User" or "App" folders. 
       I am working on a Windows machine and attempting to implement the above description. I assumed that the "App folder" was the Adobe application folder where the Acrobat.exe file is stored, and indeed there is a "Javascripts folder" in the Acrobat 8 folder under Program Files\Adobe.  But when I put a .js file in that folder and then call up the Javascript editor, the script is not found in it.
    So where really do I put Javascripts outside of the PDF?
    TIA!
    John

    Hi John,
    These might be helpful-
    http://www.pdfscripting.com/public/111.cfm?sd=40
    http://acrobatusers.com/tutorials/so-where-does-javascript-go-in-acrobat
    Hope this helps,
    Dimitri
    WindJack Solutions
    www.pdfscripting.com
    www.windjack.com

  • Where i Put my swing application jar file in jboss

    Hi experts...
    I develope swing application and convert it into jar file....I know jnlp deployment using tomcat..In tomcat i
    put my appcation.jar in webapps/root folder...This is not similar in jboss..I dont know where i put my applcation.jar in jboss.If any body know the idea please let me know..

    Hi
    You have to put your jar file in
    server/default/deploy
    Regards
    M Fazal Ur Rehman

  • I changed my iPhone lately but i can't restore my last backup since it keeps saying "itunes could not restore backup because the password was incorrect" but I don't know where to put the password to make it happen... Any suggestions?

    Hey guys,
    I just bought a new iPhone but i can't restore my backup files beacuse it keeps saying "itunes could not restore backup because the password was incorrect" but I really don't know where to put the password to restore it. I really have some files that are meaningful for me so I really need help. Any suggestions anyone?

    Select your iDevice in the iTunes.
    Choose the Summary screen (tab) and scroll to the bottom of the screen.
    Then un-select Encrypt iPhone backup.
    iTunes will then prompt you to “Enter the password to unlock your iPhone backup”, enter the password you set originally.

  • My computer screen keeps going blank and then going back to the box where I put my password in to start my comp. Why is this happening?

    My computer (Macbook) was working fine this am. I left it for an hour and then came back and the screen was black (always does that as the screensaver hardly ever works). I moved the mouse to wake it up and everything was normal. I went to adjust the volume and the screen went blank and the main page with the box where I put my password in when I first start my comp appeared. I put my password in and everything was normal again. I opened a window in Safari and before it loaded completely the same thing happened, the screen went blank and went back to the password box. Does anyone know why this is happening? I don't have an external hard drive or any blank flash drives so I can't back anything up right now and am afraid I'm going to lose everything. Thank you

    Sounds like hardware failure, called boot loop. Call Apple and or go on apple.com and make Genius Bar appointment to have your iphone reviewed by a Tech. Provided you iphone shows no physical or liquid damage they will take care of you, or if you have Apple Care Plus
    Genius Bar Rerservation :  http://www.apple.com/retail/geniusbar/

  • I am trying to organize a zip file with a bunch of links and files. But when I drag an image file to a folder, it always "Snaps to grid" instead of just landing where I put it.

    I am trying to organize a zip file with a bunch of links and files. But when I drag an image file to a folder, it always "Snaps to grid" instead of just landing where I put it. All of the files are going into the same zip file but I want them visually in the space that I put them and not at the bottom of the snap to grid folder location they are looking like.  I am trying to  drag and drop files in groups so that I can group them for now, but image files always do their own "sort by" when I drag them from my web pages. Links don't do it though.  I tried resetting the folder, and deleting the DS files. No luck.

    You keep asking variants on this same question. You've had replies in all your other threads. If you can't find them, go here and click where it says Activity:
    Thomas Cannon Jr.

  • This is less a question and more of a suggestion and I am not sure where to put it..... I would like an update that would allow you to have a tone for each individual email account

    I am not sure where to put this but I would like individual tones for all my email accounts

    Wonderful suggestion.
    You can give Apple feedback here > http://www.apple.com/feedback/
    Hop that helps

  • Why are many of my toolbar bookmarks suddenly missing, & why can't I designate where to put bookmarks now? Star won't accept double-clicks anymore.

    All of a sudden yesterday I can no longer click the star twice to tell it where to put the bookmark, and even when I click it once it doesn't save the bookmark anywhere. Also many of my toolbar bookmarks are now suddenly missing. I've tried to restore bookmarks and it says it's unable to perform that function. Help!

    You can check for problems with the <b>places.sqlite</b> database file in the Firefox profile folder.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox
    *https://support.mozilla.org/kb/Bookmarks+not+saved#w_fix-the-bookmarks-file
    *Places Maintenance: https://addons.mozilla.org/firefox/addon/places-maintenance/

  • Where to put the commit in the FORALL BULK COLLECT LOOP

    Hi,
    Have the following LOOP code using FORALL and bulk collect, but didnt know where to put the
    'commit' :
    open f_viewed;
    LOOP
    fetch f_viewed bulk collect into f_viewed_rec LIMIT 2000;
    forall i in 1..f_viewed_rec.count
    insert into jwoodman.jw_job_history_112300
    values f_viewed_rec(i);
    --commit; [Can I put this 'commit' here? - Jenny]
    EXIT when f_viewed%NOTFOUND;
    END LOOP;
    commit;
    Thanks,
    - Jenny

    mc**** wrote:
    Bulk collect normally used with large data sets. If you have less dataset such as 1000-2000 records then you canot get such a performance improvent using bulk collect.(Please see oracle documents for this)
    When you update records Oracle acquire exclusive lock for that. So if you use commit inside the loop then it will process number of records defined by limit parameter at ones and then commit those changes.
    That will release all locks acquired by Oracle and also teh memory used to keep those uncommited transactions.
    If you use commit outside the loop,
    Just assume that you insert 100,000 records, all those records will store in oracle memory and it will affect all other users performance as well.
    Further more if you update 100,000 records then it will hold exclusive lock for all 100,000 records addtion to the usage of the oracle memory.
    I am using this for telco application which we process over 30 million complex records (one row has 234 columns).
    When we work with large data sets we do not depends with the oracle basic rollback function. because when you keep records without commit itb uses oracle memory and badly slowdown all other processes.Hi mc****,
    What a load of dangerous and inaccurate rubbish to be telling a new Oracle developer. Commit processing should be driven by the logical unit of a transaction. This should hold true whether that transaction involves a few rows or millions. If, and only if, the transaction is so large that it affects the size constraints of the database resources, in particular, rollback or redo space, then you can consider breaking that transaction up to smaller transactions.
    Why is frequent committing undesirable I hear you ask?
    First of all it is hugely wasteful of rollback or redo space. This is because while the database is capable of locking at a row level, redo is written at a block level, which means that if you update, delete or insert a million rows and commit after each individual statement, then that is a million blocks that need to go into redo. As many of these rows will be in the same block, if you instead do these as one transaction, then the same block in redo can be transacted upon, making the operation more efficient. True, locks will be held for longer, but if this is new data being done in batches then users will rarely be inconvenienced. If locking is a problem then I would suggest that you should be looking at how you are doing your processing.
    Secondly, committing brings into play one of the major serialization points in the database, log sync. When a transaction is committed, the log buffer needs to be written to disc. This occurs serially for multiple commits. Each commit has to wait until the commit before has completed. This becomes even more of a bottleneck if you are using Data Guard in SYNC mode, as the commit cycle does not complete until the remote log is notified as written.
    This then brings us two rules of thumb that will always lead a developer in the right direction.
    1. Commit as infrequently as possible, usually at the logical unit of a transaction
    2. When building transactions, first of all seek to do it using straight SQL (CTAS, insert select, update where etc). If this can't be easily achieved, then use PL/SQL bulk operations.
    Regards
    Andre

  • JSP--where to put my client keystore?

    I have my webservice working. I also have my java client working. Now i'm trying
    to create a web client using JSP to access the web service. This will need the
    message-based security. The java client works fine because I can specify the directory
    of the keystore. But I don't know where to put the keystore in my JSP client.
    Anybody has some suggestions? BTW i'm using tomcat 4.1.
    many thanks.

    Hi,
    Here's a pointer to the doc on how to setup a keystore using WLS 8.1
    http://e-docs.bea.com/wls/docs81/webserv/security.html
    For Tomcat, I don't know...
    Bruce
    BTW, you might take a quick look at this, it may be of some value.
    http://dev2dev.bea.com/resourcelibrary/whitepapers/whitepaper_tomcat_migration.jsp
    Yan wrote:
    >
    I have my webservice working. I also have my java client working. Now i'm trying
    to create a web client using JSP to access the web service. This will need the
    message-based security. The java client works fine because I can specify the directory
    of the keystore. But I don't know where to put the keystore in my JSP client.
    Anybody has some suggestions? BTW i'm using tomcat 4.1.
    many thanks.

Maybe you are looking for