Load javascript function into global scope

Hello forum,
i send a lot of different scripts to IDS, but they often need to use the same functions i wrote. Is there a way to define such functions once, and to use them within subsequent scripts, without sending the function within that new script. As my scripts grow, it would be great if i don't had  to put all needed functions in that scripts and send the whole stuff with every request. The only way i see is to use evalFile, but is that a faster and better alternative?
greets
Michael

Launch ESTK
Help > JavaScript Tools Guide CS4
Search for "include", "includepath", "startup" ...
Note that the explanation of application specific startup scripts is a bit lame (almost missing, page 12) in that guide. I can't try at the moment because I'm rebuilding my Server installation right now, but I'd assume you can just follow the pattern from InDesign desktop - e.g. create a folder within the Scripts folder, and nested in that folder another one called "startup scripts" to hold your automatically executed scripts.
Dirk

Similar Messages

  • Is it possible to embed JavaScript functions into a Flash file (AS 3.0) and call within flash itself, without using the external .js file

    Scenario:
    I have a text area in flash. The user will copy paste any JavaScript  function in the text area and click execute button. The JavaScript function pasted in the text area should be executed with in the flash itself and the return value will be shown in another text field.

    yes,
    function testF(s:String):XML{
        var js:XML = <script>
        <![CDATA[
        ]]>
        </script>
        js.appendChild(XML(s));
        return js;
    ExternalInterface.call(testF(your_tf.text));

  • PL/SQL Javascript Function Call

    Can anyone offer some help on this? I am attempting to get a javascript tool tip to work on an application I am developing. I have developed a line calendar using PL/SQL outputting HTML. When I embed a javascript function into my PL/SQL htp.p function, the javascript appears to go a little crazy. Here is an example of my code:
    "htp.p('<td onMouseover="ddrivetip("Yahoos Site", "yellow", 250)"
    onMouseout="hideddrivetip()">Yahoo</td>')
    I have tried a few iterations, using different javascript, and I always get the same result. The double quotes used in the onMouseover and onMouseout function calls are a result of PL/SQL not liking single quotes. The entire code for the tooltip can be found on dynamic drives page:
    http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm
    The CSS and javascript code is placed as appropriate in the HTML page header. Am I missing something on the htp.p command?
    Message was edited by:
    jason97m
    Message was edited by:
    jason97m

    This post covers it well.
    http://inside-apex.blogspot.com/2007/08/using-tooltips-in-oracle-apex.html
    Good luck.
    Brian

  • Calling a javascript function from an Applet

    I am trying to make an applet that works on as many browsers as possible, so I am sticking to Version JCK 1.1
    I am trying to call pass the javascript function into a URL object like this
    URL url = new URL("javascript:" + function, "_self");but I keep getting a MalformedURLException. I've read some of the other comments, but they all say to use the netscape.javascript package and the JSObject class, but I can't find that object anywhere inside the API posted on Sun's website.
    Any help would be greatly appreciated.

    To access JavaScript methods, properties, and data structures from your Java applet, import the Netscape javascript package:
    import netscape.javascript.*
    public class myApplet extends Applet
    {   public void init()
    {     /* Use the following syntax to call JavaScript methods:*/
    JSObject.getWindow().eval("expression")
    /*expression is a JavaScript expression that evaluates to a JavaScript method call. */ }

  • Javascript function/inline

    Application Express 4.0.2.00.07, XE 10g.
    I have a button (Redirect to URL) with the following code -
    javascript: this.form.P2_LOCATION.value= '';this.form.P2_HELP_CALL.value= '';this.form.P2_DUE_BACK.value= '';this.form.P2_NOTES.value= '';
    and it works. When I try and change this to a function to tidy it up it doesn't work. I change the code on the button to -
    javascript: clearfields();
    and put the following in the "JavaScript/Function and Global Variable Declaration" section of the page attributes -
    function clearfields()
    this.form.P2_LOCATION.value= '';
    this.form.P2_HELP_CALL.value= '';
    this.form.P2_DUE_BACK.value= '';
    this.form.P2_NOTES.value= '';
    Pretty simple and basic I thought? But the function method doesn't fire... how come?!

    instead of this.form.P2_LOCATION.value= '';try
    $s('P2_LOCATION', '');.
    May not answer your theoretical question, but I think it might fix the problem.

  • WAD : Call Javascript Function only on Initial Load

    Hi
    I need to replicate the functionality found in the web template parameter ACTION_BEFORE_FIRST_RENDERING in a Javascript function. I need to to do this in order to read a querystring parameter, and then perform actions based on that querystring parameter.
    Is there a way to either call a function from the ACTION_BEFORE_FIRST_RENDERING command, or how do I call my Javascript function only the 1st time the page is loaded?
    I can call the Javascript function from the body onLoad event, but that results in the function being called every time the page loads, which is not what I want ... I only want the function called the 1st time the page is loaded.
    Cheers,
    Andrew

    Seems you can use this parameter to check :
    sapbi_page.m_requestIdValue
    The first time a page is loaded, that value is 1. Thereafter, it increases. I can therefore put that check in my onLoad function, and call the stuff I need if it is 1, otherwise leave the function.
    Cheers,
    Andrew

  • How to put a jsp variable into a javascript function?

    Please read the following coding. I want to pass the variable ans from jsp to the function check_answer() of javascript. ans is a string got from database. But I cannot put the variable ans into the Javascript function. Can anyone help?
    <script language="Javascript">
    function check_answer() {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer()'>");
    %>

    The following should be able to pass ans.
    <script language="Javascript">
    function check_answer(ans) {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
    %>jag

  • Using a request scope object in a javascript function

    Hello,
    is there a way to obtain a reference to a request scope attribute in a javascript function?
    or after using <jsp:useBean id="myBean" ...>, how do I pass the "myBean" object to a javascript fuction?
    Thanks for any help.
    E-

    ok, thanks...this is working for a string property of a bean... but I get an 'invalid character' error when I want to create an actual reference to the bean object itself.
    here is the jist of what I need to get working... myBean has a property 'listItems' that is a Vector of listBeans.
    function buildList() {
    var myBean = <%=request.getAttribute("mybean")%> ;
    // get referenence to the Vector property listItems
    var list = myBean.getListItems();
    // now I want to iterate the list and use the properties of the list beans
    for (x = 0 ; x < list.size() ; x++ ) {
    var listBean = list[x];
    var foo = listBean.getFoo();
    // need to use foo to populate a hierarchical list
    can I do this in JavaScript??? do I need to cast the classes to the variables?

  • Activate Javascript Function in Report Load

    Hi
    I have a javascript function that works. I put it in my ReportingServices.js file. If I have a hyperlink on my page and click it, it activates my function and my mouseover events works perfectly.
    It is a hybrid based on the following:
    http://blogs.infosupport.com/reporting-services-javascript-injection/
    How do I get my function to activate on page load so that the user don't have to click a hyperlink.
    My function:
    function mytooltipmouseover() { var el = document.getElementsByTagName('span');
    var len = el.length;
    for (j = 0; j < len; j++){
    if (el[j].innerHTML == "CHANGEME"){
    el[j].onmouseover = function () {
    var findTest = document.getElementsByTagName('span');
    var testlen = findTest.length;
    for (i = 0; i < testlen; i++)
    if(findTest[i].innerHTML=="test")
    findTest[i].style.display = "block";
    findTest[i].innerHTML = "MouseOver worked.";
    el[j].onmouseout = function () {
    var findTest = document.getElementsByTagName('span');
    var testlen = findTest.length;
    for (i = 0; i < testlen; i++) {
    if (findTest[i].innerHTML == "MouseOver worked.") {
    findTest[i].style.display = "none";
    findTest[i].innerHTML = "test";
    My hyperlink(Placeholder set as HTML in textbox):
    ="<a href=""javascript:mytooltipmouseover()"">test</a>"
    My tried custom code - not sure how to get it to work...
    Function WriteHTML() As String
    System.Web.HttpContext.Current.Response.Write("<script language='javascript'>function mytooltipmouseover()<script>")
    End Function
    Help would be greatly appreciated.
    Thanks

    For those who would like to know, got it working by adding following line in the ReportingServices.js
    function pageLoad() { mytooltipmouseover(); }

  • Call javascript function using parameters cause a immediate execute at load

    Hello.
    I recognized a strange behavior if I try to use parameters to javascript in af:clientListener method property.
    Using syntax <af:commandButton text="Init" id="cb1"
       partialSubmit="true">
       <af:clientListener method="OnInitControl1" type="click"/>
    </af:commandButton> and javascript function OnInitControl1() {
      alert('OnInitControl1 called');
    } the method OnInitControl1 is called first with the click of the button.
    But with the syntax <af:commandButton text="Init" id="cb1"
       partialSubmit="true">
       <af:clientListener method="InitCtrl('Control1')" type="click"/>
    </af:commandButton> and javascript function InitCtrl(frameName) {
      alert('InitCtrl(' + frameName + ') called');
    }the function InitCtrl is called immediate at load of the page.
    In both cases the javascript file is inserted in af:document using<af:resource type="javascript" source="/ScriptHelper.js"/>Is my syntax for "method" property of the af:clientListener wrong?
    Paul.

    Hi,
    I am using Oracle JDeveloer version 11.1.1.0.2. I have gone through your discussion. Since i am new to ADF, just wanted to request you to share the code related to <af:resource type="javascript" source="/ScriptHelper.js"/>. Also, the Tag included for the same. In my Environment, if i use <af:resource, it shows, "element af: resource is not expected".
    My requirement is similar to your as you explained in details. I need to push all the client side validation to Javascript file and need to call in the ADF pages wherever it is required (re-usable). Also, is there any specific formate for JS file to be maintained from the point of view of ADF calling the JS file.
    Your help will be greatly appreciated.
    Thanks in Advance,
    --Mahesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error when calling a Javascript function loaded as a library

    Hi All,
    I have some javascript functions in a custom js file which is in OA_HTML dir. I have loaded this js library using pageContext.putjavascriptlibrary("ABC","custom.js") in processRequest. When I deploy my code, there is a javascript error in the page. It does not seem to find the javascript function.
    My code in PR is :
    pageContext.putjavascriptlibrary("ABC","custom.js")
    someBean.setOnFocus("javascript: callFunc(this);"); //callFunc(obj) is defined in custom.js
    It works locally when I have my custom.js in myhtml directory. I am getting an error when I deploy the code on to the instance's apps server. Is there something that I am missing?
    Thanks in advance
    Raja

    Raja,
    You can bounce apache , and server cache would be refreshed!I guess then ur updated js function should work. Also,check ur js function works correctly on jdev.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                               

  • Can I use LabVIEW to load data directly into system memory? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Win32 function to read the data from the card and now I want it to go directly to system memory.

    Can I use LabVIEW to load data directly into system memory from a VI? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Call Library function to read the data from the card and now I want it to go directly to system memory.
    The data is being received at 1Mbps.
    Thanks

    Two questions:
    One, if it's a serial card, then presumably it gives you more serial ports, like COM3, COM4, etc. If so, VISA would see the COM ports, and not the card directly. The drivers for the card should make it so that you see the extra serial ports from the OS. If you don't see the extra COM ports from VISA, then it sounds like the drivers for the card are not installed properly. Do the extra COM ports show up in Device Manager?
    Two, you said that you're using a Call Library function to get the data and you want to put it into system memory. Errr.... you just read the data and you have it in memory by definition. Are you saying you need a way to parse the data so it shows up on a graph or something?

  • Pass a Java Bean into Javascript function.

    Good day. Please help urgent :
    I am trying to pass an instance of MyBean class into a javascript function
    This code is added to the form.
         private String getJavaScriptForLaunchNewComponent()
              StringBuffer sb = new StringBuffer();
              sb.append("<SCRIPT language='JavaScript'>");
              sb.append("    function testFunction(zBean) { ");
              sb.append("popAssetWinSpecs = \"left=250,top=250,width=300,height=300,scrollbars=no,toolbar=no,menubar=no,resizable=no,status=no,titlebar=no,location=no\";");
    sb.append("htmlfile=\"/irj/servlet/prt/portal/prtroot/com.roche.mss.pdf.comp.PDFLauncher?zBean=\"+zBean;");
    sb.append("window.open(htmlfile,\"editWindow\",popAssetWinSpecs);");
    sb.append("return false;");
    sb.append("    }");
    sb.append("</SCRIPT>");
    return sb.toString();
    This code is set in the create component meth
         private Component buildLink(){
              GridLayout grid = new GridLayout(1,1);
              grid.setCellSpacing(5);
              TestBean zBean = new TestBean();
              zBean.setValue("Me Now");
              Link link = new Link("myLink");
              link.addText("Print PDF");
              link.setOnClientClick("testFunction("+zBean +")");
              grid.addComponent(1,1,link);
              return grid;
    Is this possible ????
    Thanks.

    solved it. Thanks

  • How to call javascript function when form load[like onload="fun()" in html]

    I have to call javascript function at the time of iview is loading. I am not able use onload event which is not working in SAP Portal environment. Please suggest me any other alternative to call the function at the time of iview is loading. I have to set some properties when form is loading.

    I will explain my scenario correctly
    Let us take two pages
    1. Main Page (A)
    2. Child page (B)
           I have displayed records in tableview and each having checkbox and two buttons "print" and "viewDetails"  at down in page A. If I clicked "print" button the records which i have selected checkboxes details will be displayed in new window( page B). In page B i have given this following code
      <script language="javascript">
          window.opener.setTarget('Search');
      </script>
    setTarget() function is in page A.
    function setTarget(opt) {
      if(opt=='print')
         opt="";     
         document.<%=strFormControl%>.target="_blank";
       else
            document.<%=strFormControl%>.target="_self";
    This code is executing after the content of all records details displayed.
    My condition is If i click print button new window is opened and details are displaying. And before displaying content in new page B (means after opened new window) if i click on "viewDetails" button that is also opening new window because <script> code is not executed not yet. but it should display in same window when i click "viewDetails" button.

  • It keeps loading when login into Secure Global Desktop

    It keeps loading when login into Secure Global Desktop
    Configurations listed below:
    OS: Windows 7
    Java:6

    Hi Frank,
    It happened when attending labs exercise in oracle ADF training .The labs needs the SGD to first login.
    Regards.

Maybe you are looking for

  • Check Duplicate Postings, GL, A/R, A/P

    Hi Experts, My requirement is to post accounting documents based on data pushed from another interface via RFC.  We're using BAPI_ACC_DOCUMENT_POST to handle this.  Now, the client wants us to handle double postings to prevent reprocessing of same da

  • Save as PDF yields no text display in Apple's Preview

    I'm trying to output a pdf file for a client. When I do a "Save As" and select Photoshop PDF, the resulting document shows no text in the Preview application. It does show up in Acrobat however. Similarly, when adding the pdf to an email, the text do

  • Package and import

    I have a problem about the syntax package and import . If i create a class file that call "Play.java" and keep it at directory call "test". Now , i create the main file that call the "Play" class and this current file keep at directory that call "dem

  • H.264 and QT 7.0.3 vs QT 7.0.4

    This is an alert to all who have been frustrated with making H.264 movies for the 5th generation iPod video. iTunes will play movies the iPod won't. The iPod is more picky in what it can play. In particular, the iPod requires an .mp4 encoded with H.2

  • I wanted to dipslay my bookmarks on two visable lines, but all I have are tiny favicon icons ?

    Basically I have 4-5 rows of bookmarks in my Firefox home page. However when I tried to load software so that I could visablly see two rows of Bookmarks, all my icons sharnk to favicon size and that's no good to me. Please help it's sooo frustrating