Global javascript functions in cp8

I need to be able to call a javascript function from any page, when needed, in cp8. 
I know I can add it as an "On Enter" / "Execute Javascript" on every page, but is there an easier way?
I want to define the function once, but call it from anywhere without having to define it over and over.
Anyone know how to do that in cp8?

Yeah, that's always an option, and I've often edited some of the core files after publishing to get the result that I wanted.
It works, but then every time I publish, my changes to the files are lost.
I was really looking to avoid the workflow where my edits get overridden on publish and then have to be re-tweaked again.
Hoping for an easier way to insert a javascript function that all the pages can utilize and not have to repeat.
thanks for the response though

Similar Messages

  • Playing a symbol timeline in Edge from Javascript function in an exteranl web page

    All-
    I have a javascript function in an external web page.  i want to use this function to call a symbol timeline inside an edge file.
    i've read about bootstrapping but i'm unsure how to use it in my project
    any ideas?
    Z

    Hi again Elaine,
    I actually had some success after many attempts with using your code. I can control the .stop() and .play() of the "NamePlate_sym" symbol. Yet, I am still having trouble doing anything else with it. I cannot .hide() it, nor use .html("Change text") on another element on the stage called"Rectangle". If I can accomplish that and all a global function on the stage, I'm in good shape.
    I placed the following script in the header of the .html file that gets loaded into the iFrame within the Edge composition:
      <script type="text/javascript">
       window.parent.AdobeEdge.bootstrapCallback(function(compId) {
       comp = window.parent.AdobeEdge.getComposition(compId).getStage();
       alert("CompID is "+compId);
       var symbol = document.createElement('div');
       symbol.innerHTML = 'Rotate';
       symbol.style.cssText = 'background-color:#fea; width: 50px; text-align: center;';
       symbol.style.cursor = 'pointer';
       symbol.onclick = function() {
        if (comp.getSymbol("NamePlate_sym").isPlaying()) {
         comp.getSymbol("NamePlate_sym").stop();
        else {
         comp.getSymbol("NamePlate_sym").play();
       window.parent.document.body.appendChild(symbol);
            </script>
    Once I put window.parent. in the first two lines of code and the last, my test worked. As I mentioned earlier though, I still can't get the syntax correct to .hide() an element (i.e. comp.getSymbol("NamePlate_sym").hide(); does not work), or more importantly, change the innerHTML value of an element on the stage. The code either does nothing or freezes.
    Thanks... Tommy

  • Adding Global Search function in Webhelp

    I have been asked to add global search functionality to my
    website. As far as i understand, the only way of doing this using
    Webhelp is to use merged projects?
    As i have 40 separate XPJ files (some very large), this
    merged projects method didn't work very well. For a start you got
    lost in the vast number of projects and bookmarks displayed in the
    merged TOC. Instead, from a main menu, each guide opens up in the
    same fixed window and just displays its owns TOC. Curently you can
    only search in the selected guide.
    Having looked at Peter Graingers site, ZoomSearch would seem
    to work OK. Does anyone know of any other method i could use or
    free alternatives to ZooomSearch?
    Thanks

    First, if you Google "refresh page" you'll have several
    JavaScript options available to choose from.
    Second, I can't show you my merged WebHelp, because it's
    proprietary online Help provided with our product, but I used
    Peter's method for a merged project of 42 projects, ~2.5K topics,
    and mucho graphics. Unfortunately, in a WebHelp merged project, RH
    provides an anemic, basic search only.
    We had elected to place our projects within 14 major
    categories in the TOC, so as to reduce the size of the TOC when the
    help was opened. Each category links to a "navigation" page in the
    parent project that provides a description of the category and all
    first-level topics within each project in the category. This
    category structure helps the user identify the major functional
    areas, and helps the seven writers keep track of where their
    particular projects appear.
    GETTING STARTED
    + Release Notes
    + Installation
    + etc.
    TRADING
    + Program Trading
    + Fixed Income Trading
    + etc.
    This proved serendipitous when we decided to use Zoom, since
    we were able to classify the same RH project folders under
    identical Zoom categories, allowing users to select a single
    category from a dropdown menu if they want more tightly focused
    results.
    Because our help is provided on a CD and is distributed on a
    customer's server, we've had to implement Zoom search in Javascript
    mode. Admittedly, the JavaScript mode in Zoom doesn't provide full
    functionality either, but it's still better than RH (you can use
    wild cards, special characters (underscore, colon, slash, etc.) to
    "join" words, etc.).
    Some Zoom issues:
    Since RH ignores special Zoom tags in source files, such as
    ZOOMSTOP/ZOOMRESTART, ZOOMKEYWORDS, etc., and over-writes them in
    the output when generating/publishing topic modifications, we are
    running the Zoom indexer against the source files and placing the
    five Zoom files (search.html, zoom_pageinfo.js, etc.) in the output
    folder. The Zoom 5.0.1005 build will automatically rename the path
    from the source "/projects" to the output "/mergedProjects" if you
    select that option.
    Currently, a bug in Zoom replaces any closing HTML tag (HREF,
    SPAN, etc.) that appears before a period, comma, semicolon, or
    colon with a space. So, you need to run a Find/Replace to eliminate
    those extra leading spaces (in the zoom_pageinfo.js file). I use
    FAR for this; you can create a .FarRun file with entries like this
    to do them in batch. Note that the 90_zoompageinfo_docsql01.FAR
    FarList was created to contain only the zoom_pageinfo.js file, and
    the "OpenFarList" line only needs to appear once in the .FarRun
    file. After I run the Zoom indexer against the project, I only have
    to double click the .FarRun file to run the batch replace.
    Good luck,
    Leon

  • Write javascript function in the mime repository

    Hey all,
    I Wrote a javascript functions inside the WAD html, and it works great.
    Now I want to distribute this code to many WAD's.
    I belive that the right way is to move the code to the mime repository and call it from the WAD's.
    How can I Call a function in a file.js file that exists in the se80?
    Thanks in advanced
    Hagai

    Try thowing this line in your <head> tag:
        <script language="JavaScript" src="/sap/bw/Mime/Customer/JavaScript/myJSFile.js">
          <!-- { } -->
        </script>
    When you refer to your javascript, just use
    <script type="text/javascript">
    //Javascript here
    </script>
    There are also caching issues when using javascript.  After you make a change to your file, use TCODE smicm.  In TCODE SMICM, from the file menu... Goto->HTTP Server Cache->Invalidate->Global in System.  This will invalidate the cache so you can see your new changes.
    Cheers,
    -Brendon
    Message was edited by: Brendon Lipchen
    Message was edited by: Brendon Lipchen

  • Repeated area and javascript function

    Hello every body,
    I have a problem and I can't find the solution, but I am sure
    it is solvable !
    my page is a PHP page, I work with Dreamweavere 8
    I have a catalog list which presents global product reference
    based on article designation
    for instance : poppy flower
    when I click on the image I arrive on a new page with
    detailed information, and the different references available (in
    fact I can have 1, 2 or 3 articles references depending on the
    different available sizes).
    I have a form named "ChoixArticle", containing a table with
    the following info coming from a database MySql
    article reference
    article height
    article width
    article color = drop-down list
    article price
    quantity : text area to fullfill
    total price for the article
    I insert a javascript function which works correctly when I
    have only ONE product as result of my query, BUT when I have more
    than one result, it doesn't work anymore
    I insert the code of my page for more brightness.
    hope my explanation is clear enough
    Thank for your welcome help !
    Françoise from Paris
    ========================
    there below my code
    ========================

    > In this case he is not using "id", but "name". When the
    js parser sees
    > form controls with the same name it creates a
    collection.
    >
    > document.forms['ChoixArticle'].elements['res']
    >
    > The first text box is referenced as:
    > document.forms['ChoixArticle'].elements['res'][0]
    > and so on.
    Ahhh I did not pick up on that. Thanks for pointing it out.
    E. Michael Brandt
    www.divaHTML.com
    divaPOP : standards-compliant popup windows
    divaGPS : you-are-here menu highlighting
    divaFAQ : FAQ pages with pizazz
    www.valleywebdesigns.com/vwd_Vdw.asp
    JustSo PictureWindow
    JustSo PhotoAlbum, et alia

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

  • JavaScript function which fetches return_value from List of Values

    Hi,
    I have created List of Values named "NICKS". I want to write JavaScript function "get_workers_fullname(nick)" which returns display_value from List of Values. The parameter of function is return_value of List "NICKS".
    I am new with this and don't know how to handle this case.
    Please help me.

    Hi,
    The LOV, I mean is the item in Application's Shared Components. I don't mean the visible SelectList on the page.
    This is what I found in ApEx's help: "A List of Values can be referenced by page items as well as report fields. It controls the values displayed and limits the user's selection. Lists of Values can be static (based on values you enter) or dynamic (based on a SQL query)."
    I'd like to access values in such LOV from JavaScript. I am not sure it is possible.
    Cheers,
    Tom.

  • Passing value from javascript function to servlet

    Hello everybody,
    i need to pass parameter from javascript function to servlet.
    what i wrote is :
    function callPopulateServlet(t)
    var h =document.NewRequest.services;
    var y = t.selectedIndex;
    alert(h.options[y].value);
    var id=h.options[y].value;
    <%session.setAttribute("id",id);%> // am getting error at this point
    document.NewRequest.submit();
    with this id am quering values from database through servlet.
    any body knows plz help me.
    thanks,
    anil.

    this is the error am getting
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

  • How to pass value to pop up window using javascript function?

    I am not sure how to do this, I want to open new window from existing form,This is Mod/PLsql for consists some javascript functions also. When I am clicking on new window in form then new form should open with results of value entered,but new window form is opening with main page :( , not able to get text box value from parent form. How to call textbox input value in popup window from parent window using javascript?
    currently I'm using following code:
    HTP.p('<script type="text/javascript">
    function pop_up5()
    var l_url=window.opener.document.getElementById("p_single_store_pc").value;
    window.open(l_url, '''', ''fullscreen=no, scrollbars=1'');
    </script>' );
    Edited by: user11970612 on Jun 14, 2012 5:02 AM

    this is probably due to the Javascript code and not a "real link" to another page... I don't know if the null is due to the Javascript...
    But if you really really want to use javascript instead of a ... you can pass the location of the url with JSP (on your main page) as a parameter to the open window... (...) u can put instead of main.jsp <%= request.getServerName()+request.getRequestURI() %>
    the value <%= ... %> will return something like test.com/html/main.jsp
    Hope this helps.

  • How can I have a backing file call a JavaScript function?

    I have a Weblogic portal with a JSP portlet. The portlet has a backing file. How can I get the backing file to call a JavaScript function in my portlet?
    thanks

    Hi
    your questions are not correct because you are mixing up server side operations with client side operations.
    First server side code executes then the page is sent to the browser , then any javascript executes on the browser. So asking for javascript to be called from backing file (server side) doesn't make sense or asking for javascript to read a parameter doesnt exactly work either.
    However in your server code suppose you have a variable action in the request that you want javascript to know then in your JSP you would add something like
    <script type="text/javascript">
    var action = '${requestScope.action}';
    alert(action);//or whatever you want to do
    <c:if test="${requestScope.someOthervariable == ''xyz'}"><%-- this check is done on the server --%>
    callSomeJavascript(); <%--this javascript is only executed when the server side value of someOtherVariable is xyz --%>
    </c:if>
    </script>
    i.e. you can output the javascript that has the variables you need or the function calls you want.
    Like I said understand whats server side and whats client side.

  • How can I call a custom javascript function when clicking on cfgrid cell.

    I would like to call a custom javascript function when
    clicking on a cell in an cfgrid (of html format). The closest thing
    I can find is to use the HREF="" attribute, but it doesn't seem to
    work with javascript inside it.
    Simple example:
    <cfgridcolumn name="Foo" header="Foo"
    href="javascript:customFunction(#ID#);">
    Do I need to tap into the underlying Ext JS funtionality? If
    so, where can I start?
    Thanks!

    Hi,
    According to your post, my understanding is that you want to hide/show list columns based on specify the permission for Users, SharePoint Groups or Active Directory Groups.
    Here is a solution from CodePlex for your reference:
    SharePoint 2013 Column & View Permission
    https://sp2013columnpermission.codeplex.com/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How can I call a servlet method from a javascript function

    I want to call l a servlet method from a javascript function.
    Does any one have an example of code.
    Thinks in advance

    Actually, as long as the servlet returns valid javascript, you can indeed "call it" from the client. It will initiate a request and return the result to the browser.
    This example uses Perl, but it could be easily modified to go to a servlet instead.
    Note that it is only supported in DOM browsers (IE6+/NN6+/etc)
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html>
    <head>
    <title> Test server-side JS </title>
    </head>
    <body>
    <script type="text/javascript">
    function checkIt(variable, value)
    var newScript = "cgi-bin/validateJS.cgi?"+variable+"="+value;
    var body = document.getElementsByTagName('body').item(0)
    var scriptTag = document.getElementById('loadScript');
    if(scriptTag) body.removeChild(scriptTag);
    script = document.createElement('script');
    script.src = newScript;
         script.type = 'text/javascript';
         script.id = 'loadScript';
         body.appendChild(script)
    </script>
    <p>Test.</p>
    <form id="f1" action="">
    <input type="text" name="t1" id="t1" onChange="checkIt(this.name, this.value)">
    </body>
    </html>
    validateJS.cgi
    #!/opt/x11r6/bin/perl
    use CGI qw(:all);
    my @valArray = split(/=/,$ENV{QUERY_STRING});
    print "Content-type: text/javascript\n\n";
    # myPass is the password
    $myPass = "foobar";
    if ("$valArray[1]" eq "$myPass")
    print "alert(\"Success!!\")";
    else
    print "alert(\"Failure!!\")";

  • How to call a Javascript function from backing bean without any event

    Hi,
    Someone knows how to call a Javascript function from backing bean without any event ?
    thanks

    Please review the following thread:
    ADF Faces call javascript
    Luis.

  • Set multiple items with javascript function in chart link

    Hi Folks
    I am able to use the javascript $s function to set the value of one item from a chart link. I need to pass values to multiple items.
    Is there a way to use javascript function to pass values for multiple items on a page from a chart link
    Appreciate your responses
    Thanks
    Gopal

    Hi Arnau,
    You need to surround your JavaScript code like this (without the spaces before and after script):
    < script language="Javascript">
      window.open("<%=ABAP_VARIABLE%>").focus();
    </script >
    Regards,
    Patrick.

  • How to call a bean method through a javascript function

    I dont discover any problems calling the bean method in this maner:
    <%= helpdesk.data() %>
    But, when I use a Button Onclick= to call the script function and which then is going call my bean method
    an error on the page is reported!
    I have include som code which gives you the idea of what Iam searching for. And is it possible to call
    the bean method without doing from a new jsp page?
    If you have any suggestions to why it doesnt work, please let me know.
    I use Apache Tomcat 4.0
    Best regards Micah.
    <jsp:useBean id='helpdesk' scope='application'
    class='helpdesk.testdb'/>
    <html>
    <head>
    <script language="javascript">
    function broadcast()
    helpdesk.data();
    </script>
    </head>
    <body>
    <input type="button" value="Broadcast" onclick= broadcast()>
    </body>
    </html>

    It's actually quite simple:
    Beans run server-side
    Javascript runs client-side
    So you will never be able to run server-side-code thru the client...

Maybe you are looking for

  • Zip code Problem (or Frustrated with iTunes "Support")

    I have been having a new problem (with an old credit card) on iTunes, where I get the repetitive error that the zip code I've entered does not match the one the bank has for the card.  I have ensured that the zip code is correct and checked the bank

  • Unread Badge On Calendar

    A red unread badge has mysteriously appeared on my icloud.com cleandar icon.  Where would an unread calendar event be found, especially since I haven't added anything to my calendar since seeing this unread badge?  The unread badge does not appear on

  • Call a unix script from pl/sql package

    Hi, Using 11.2.0.3 on AIX. Is it possible to call unix script from pl/sql package? I am cretaing a file in a directory but would like this to automatically be written to an archive directory as well. Could either use 2 utl_file.put_lines to 2 separat

  • Unable to set heap size to 4gb in sun java application server pe 8.2

    i have sun v890 machine with 32gb ram and solaris 10 i am running sun java system application server platform edition 8.2 when i am setting max heap size to 4GB it is giving an error Invalid maximum heap size -Xmx4096m the specified size exceeds the

  • Reinstalling CS3 Why the is it asking for Adobe Fireworks CS4

    When attempting to reinstall my Photoshop CS3 on my Mac because of the clone brush not working I am prevented from doing so because It is asking for Adobe Fireworks CS4. Thanks