Conflicting OnLoad javascript functions

I am trying to implement two solutions in my application
1) Controlling window scroll position on a submit and redirect to the same page
which I have working successfully as per thread
Control window scroll position on a submit and redirect to the same page
This solution has the following code in the PAGE HTML Body Attribute
onload="javascript:ScrollIt()" onscroll="javascript:setcoords()"
I have 2 items on each page which hold the X,Y co-ords as I scroll. When the page reloads I return to these co-ords in the ScrollIt() onload process.
2) Sticky Hide and Show Regions as described in the instructions At
http://www.oracle.com/technology/products/database/application_express/packaged_apps/sample_code.html
It uses an onload Application process that calls the packaged proc
show_hide_memory.show_hide_collection_output();
In the proc the following javascript is called:
htp.prn('window.onload=function()
PROBLEM: I can't get both working at the same time! I'm assuming that the OnLoad proc is overriding that other one.
Any help please would be appreciated...
regards
Paul P

Hello,
Compile this as the Package Body. I will update the packaged code change in the next day or so.
create or replace PACKAGE BODY show_hide_memory AS
  PROCEDURE show_hide_collection AS
  l_arr apex_application_global.vc_arr2;
  l_found boolean := FALSE;
  l_collection_name VARCHAR2(255) := 'SHOW_HIDE_COLLECTION';
  BEGIN
    IF(wwv_flow_collection.collection_exists(p_collection_name => l_collection_name) = FALSE) THEN
      htmldb_collection.create_or_truncate_collection(p_collection_name => l_collection_name);
    END IF;
    l_arr := apex_util.string_to_table(p_string => v('TEMPORARY_ITEM'),   p_separator => ']');
    -- If the array member count of l_arr < 3, then the following code will raise an exception
    FOR c1 IN
      (SELECT seq_id
       FROM apex_collections
       WHERE collection_name = l_collection_name
       AND c001 = l_arr(1)
       AND c002 = l_arr(2)
       AND c003 = l_arr(3))
    LOOP
      -- It exists, so delete it
      apex_collection.delete_member(p_collection_name => l_collection_name,   p_seq => c1.seq_id);
      l_found := TRUE;
    END LOOP;
    IF l_found = FALSE THEN
      apex_collection.add_member(p_collection_name => l_collection_name,   p_c001 => l_arr(1),   p_c002 => l_arr(2),   p_c003 => l_arr(3));
    END IF;
    COMMIT;
  END show_hide_collection;
  PROCEDURE show_hide_collection_output AS
  BEGIN
    htp.prn('<script type="text/javascript">' || CHR(10));
    htp.prn('<!--' || CHR(10));
    htp.prn('function pg(){' || CHR(10));
    FOR c1 IN
      (SELECT c003
       FROM apex_collections
       WHERE collection_name = 'SHOW_HIDE_COLLECTION'
       AND c001 = wwv_flow.g_flow_id
       AND c002 = wwv_flow.g_flow_step_id)
    LOOP
      htp.prn('htmldb_ToggleWithImage(''' || c1.c003 || 'img'',''' || c1.c003 || 'body'');' || CHR(10));
    END LOOP;
    htp.prn('}' || CHR(10));
    htp.prn('addLoadEvent(pg)' || CHR(10));
    htp.prn('//-->' || CHR(10));
    htp.prn('</script>' || CHR(10));
  END show_hide_collection_output;
END;Carl

Similar Messages

  • How to execute a javascript function in the body onload?

    Hi everyone!
    As you know in the HTML body attribute. You must specify the value of onload
    What is the correct sintaxis for execute a function since in the onload body?
    I only want to do some like this, but only I do it in APEX:
    <body onload ="javascript:namefunction();" >
    I do not know how to use #ONLOAD# when you using want to set some value.
    Could u help me please ?
    Any help would be very appreciated.
    Thank u in advance
    Best Regards

    Hi Chris
    Thank you for your help
    I tried with the next code but it doesn´t work.
    Do you know for what?
    Best Regards
    I paste the next code in the HTML Header :
    <head>
    <script language="JavaScript" type="text/javascript">
    function addLoadEvent(func){
    var oldonload = window.onload;
    if (typeof window.onload != 'function'){
    window.onload = func;
    else {
    window.onload = function() {
    oldonload();
    func();
    function ejecuta()
    doSubmit('ACEPTAR_R')
    addLoadEvent( ejecuta );
    </script>
    </head>

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

  • 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

  • Javascript function not working in template-based html files

    Does anyone have any insight as to why the following function works only in the .dwt file but not in the related html files?
    *Note: it only works in the dwt file if I change the path of:
    var imgs = new  Array('images/header1.jpg','images/header2.jpg','images/header3.jpg');
    to
    var imgs = new  Array(../'images/header1.jpg',../'images/header2.jpg',../'images/header3.jpg');
    but with the paths reading correctly (as below) in the html files it still doesn't work...
    <script type="text/javascript">
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    var imgs = new Array('images/header1.jpg','images/header2.jpg','images/header3.jpg');
    var delay = 7500;
    var counter = 0;
    function preloadImgs(){
      for(var i=0;i<imgs.length;i++){
        MM_preloadImages(imgs[i]);
    function randomImages(){
      if(counter == (imgs.length)){
        counter = 0;
      MM_swapImage('rotator', '', imgs[counter++]);
      setTimeout('randomImages()', delay);
    </script>
    </head>
    <body onLoad="preloadImgs();randomImages()">
    Any help would be appreciated!
    Andy

    Wow - now I have a real doozy for you. That duplicate function has generated itself all on its own. The script in the template file is:
    <script type="text/javascript">
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    // Comma separated list of images to rotate
    var imgs = new Array('images/header1.jpg','images/header2.jpg','images/header3.jpg');
    // delay in milliseconds between image swaps 1000 = 1 second
    var delay = 5000;
    var counter = 0;
    function preloadImgs(){
      for(var i=0;i<imgs.length;i++){
        MM_preloadImages(imgs[i]);
    function randomImages(){
      if(counter == (imgs.length)){
        counter = 0;
      MM_swapImage('rotator', '', imgs[counter++]);
      setTimeout('randomImages()', delay);
    </script>
    As you can see - no duplication.
    For some inexplicable reason, this is being added in to all the html pages based on the template:
    MM_swapImage('rotator', '', imgs[counter++]imgs[i]);
    function randomImages(){
      if(counter == (imgs.length)){
        counter = 0;
    Which explains why it works in the template file but not in any the html files. Of course, because the code is not in an editable region, I can't remove it manually from the html files. Have you ever heard of code generating itself in this manner? Or how to solve it?

  • In onLoad JavaScript, I'm getting "Error: Permission denied to access property 'classes'" when I access Components.classes; how do I enable that permission?

    I need to emulate several ActiveX functions in my client's web application. I have located several Mozilla web pages that describe how to do the things I need, and I have attempted to implement those instructions. However, I can't seem to get past the first line of code. In my web page, I am calling a JavaScript function using the onLoad attribute of the <body> tag. I am using the Navigator object to determine that the browser is Firefox. I then attempt to access the extension classes using the following code on lines 51 and 52 of the Download.js file:
    var C = Components;
    var CC = C.classes;
    The Web Console gives me these two messages:
    [13:51:55.621] The Components object is deprecated. It will soon be removed. @ http://distribution:781/NewDDI/DownLoad.js:51
    [13:51:55.621] Error: Permission denied to access property 'classes' @ http://distribution:781/NewDDI/DownLoad.js:52
    How do I enable adequate permission to be able to access the Components classes?

    I think Components is available only in extensions (or otherwise privileged code) and not in ordinary web pages.

  • How to passed an xsl parameter to a javascript function inside an xsl styel

    Hi:
    I am having problem passing an xsl param variable as a parameter to a javascript function inside an
    xsl styelsheet.
    Here is my xsl stylesheet.
    >
    <xsl:param name="numberOfRecordsFromDatabase" select="search-result/rec-num" />
    <xsl:template name="Body">
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
    onLoad="cloneHeader();window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>);"
    onresize="cloneHeaderResize();window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>);">
    </body>
    </xsl:template>
    I am trying to pass a variable called numberOfRecordsFromDatabase to
    a javascript function called window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>).
    Is this possible?
    If not, is there a way to do this.
    Any hint would be greatly appreciated.
    Yours,
    Frustrated.

    I would do it like this:
    Load the "search-result/rec-num" value into a field within an invisible div tag:
    <div id="miscproperties" style="visibility:hidden">
       <input id="numberOfRecs" type="text">
          <xsl:attribute name="value">
             <xsl:value-of select="search-result/rec-num"/>
          </xsl:attribute>
       </input>
    </div>Then, your js function can retrieve the value via
    var x = document.getElementById("numberOfRecs").valueR. Grimes

  • Access Java Array in Javascript function

    Hi, could someone please help me, I have an array that gets populated in java code and I need to see it in a javascript function.
    Here's what I have so far:
    //In java class for AvgCostChart.jsp
    private String[] month;
    public String[] getMonth()
    {//code to populate
    return month;}
    Then in my javascript onLoad function I try to access it. I know how to access the values one at a time like this.
    var month1='#{AvgCostChart.month[0]}';
    But how do I pass this to a function.
    I tried assigning to to another array to loop through the values like this:
    var myArr = new Array();
    myArr'#{AvgCostChart.month}';
    alert (myArr[0]);
    But that does not work, any one done this before.
    I've also tried saving it in the session and then accessing it but can't get that to work either.
    Any help will be greatly appreciated.

    Hi,
    Please go through the following thread:
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=60147
    Hope this helps
    Cheers
    Girish

  • Having problem with calling external javascript functions in LV

    Hi,
    I found this VI: http://lavag.org/topic/10304-discuss-calling-external-javascript/, which I believe can be really helpful for my work. The problem is I can't get it to run based on the following problem:
     - Apparently the "ScriptControl" cannot be loaded
    I am using LabView 8.6, and this vi has been produced in a 8.0 version. Do you think this is the problem? If not, what could cause this problem running this VI?
    Thanks,
    Diogo

    Hi,
    To start I am using this examplo from the google code page.
    <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google Maps JavaScript API Example</title>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false"
                type="text/javascript"></script>
        <script type="text/javascript">
        function initialize() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(37.4419, -122.1419), 13);
            map.setUIToDefault();
        </script>
      </head>
      <body onload="initialize()" onunload="GUnload()">
        <div id="map_canvas" style="width: 500px; height: 300px"></div>
      </body>
    </html>  
    It loads a basic map, and is saved in a html file created for example in Notepad. Basically as I said the VI is very simple, see next image.
    But like I said, this strategy does not allow labview to interface dinamically with the javasscript code in the html file. Doing it this way, I would have to constantly update the code in the file with new coordinates and loading the map again. This causes the mentioned flickering problem that I also had with static maps.
    Diogo

  • Javascript functions don't work

    Hi,
    I have just tried the following code putting the script
    header to execute it on the client side:
    <script>
    if(ParentValue == String("Y"))
    EnableSubGroup();
    else
    DisableSubGroup();
    </script>
    I do not get the object expected error anymore
    but the functions don't work, why is this?
    ----Function definition ------
    <script type="text/javascript">
    function EnableSubGroup()
    document.forms["SubForm"].elements["SubGroupDD"].disabled='false';
    function DisableSubGroup()
    document.forms["SubForm"].elements["SubGroupDD"].disabled='true';
    </script>
    Thanks
    Fifi

    fifo85 wrote:
    > Hi,
    >
    > I have just tried the following code putting the script
    header to execute it
    > on the client side:
    > <script>
    > if(ParentValue == String("Y"))
    > {
    > EnableSubGroup();
    > }
    > else
    > {
    > DisableSubGroup();
    > }
    > </script>
    onload=function(){
    document.forms["SubForm"].elements["SubGroupDD"].disabled =
    !(ParentValue == "Y")
    This will disable SubGroup if "ParentValue" is not "Y"
    Mick
    >
    > I do not get the object expected error anymore
    > but the functions don't work, why is this?
    >
    > ----Function definition ------
    > <script type="text/javascript">
    > function EnableSubGroup()
    > {
    >
    document.forms["SubForm"].elements["SubGroupDD"].disabled='false';
    > }
    > function DisableSubGroup()
    > {
    >
    document.forms["SubForm"].elements["SubGroupDD"].disabled='true';
    > }
    > </script>
    >
    > Thanks
    >
    > Fifi
    >

  • Passing JSP into JavaScript function

    I have a database table containing a date for the end of an auction, I am able to successfully take the date from the database but I am having problems passing it and casting it to a date object within a javascript function. The purpose of the function is to begin a countdown to the passed in date. Any suggestions? The countdown function i have only works with a hard coded date object.
    <SCRIPT LANGUAGE="JavaScript1.2">
    mDate = new Date("October 18 2004")
    function countdown(){
    var now=new Date()
    var diff=mDate.getTime()-now.getTime()
    document.bid.days.value = Math.round(diff/(24*60*60*1000))
    document.bid.hours.value = Math.round(diff/(60*60*1000))
    document.bid.minutes.value = Math.round(diff/(60*1000))
    document.bid.seconds.value = Math.round(diff/1000)
    document.bid.mseconds.value = diff
    var id=setTimeout("millenium()",1)
    </SCRIPT>
    <body onLoad="countdown()">
    <form name="bid" method="post" action="">
    <p>Timeleft</p>
    <TABLE BORDER=0>
    <TD width="79">Days: </TD>
    <TD width="81">
    <INPUT TYPE="text" NAME="days" SIZE=15></TD> <TR>
    <TD width="79">Hours: </TD>
    <TD width="81">
    <INPUT TYPE="text" NAME="hours" SIZE=15></TD> <TR>
    <TD width="79">Minutes:</TD>
    <TD width="81">
    <INPUT TYPE="text" NAME="minutes" SIZE=15></TD> <TR>
    <TD width="79">Seconds: </TD>
    <TD width="81">
    <INPUT TYPE="text" NAME="seconds" SIZE=15></TD> <TR>
    <TD width="79">Milliseconds:</TD>
    <TD width="81">
    <INPUT TYPE="text" NAME="mseconds" SIZE=15></TD> <TR>
    </TABLE>
    </form>
    I wish to pass it as follows:
    <body onLoad="countdown(<%rsProduct.get........%>)"> and then cast within the function
    .............................................................................JSP.....................................................................................................
    <% Connection dbConn = null;
         try
              Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
              dbConn = DriverManager.getConnection("jdbc:sybase:Tds:compserver:5000/syb3044","syb3044", "syb3044");
              Statement select = dbConn.createStatement();           
              int ID = Integer.parseInt(request.getParameter("carId"));
              ResultSet rsProduct = select.executeQuery("SELECT * FROM car WHERE carID =" + ID);
              if(rsProduct.next()){}
    <%
              rsProduct.close();
    catch (SQLException sqle)
              out.println(sqle.getMessage());     
    catch (ClassNotFoundException cnfe)
              out.println(cnfe.getMessage());
    catch (Exception e)
              out.println(e.getMessage());
    finally
              try
                   if(dbConn != null)
                        dbConn.close();
              catch (SQLException sqle)
                   out.println(sqle.getMessage());
         }%>
    PLEASE NOTE THAT I AM A SECOND YEAR COMPUTER SCIENCE STUDY!
    sorry if code is messy to read.
    Regards

    Looks like everyone's having a countdown problem.....
    The script in this thread is awefully like in this one:http://forum.java.sun.com/thread.jsp?forum=45&thread=514095&tstart=0&trange=15
    Anyway, there're what you can do. Write out the Date object in JSP as a Javascript Date, two ways to achieve that:
    1, mydate.getTimeStamp() is should return a long value, time in millisec, so
    var mDate = new Date(<%= myDate.getTimeStamp()%>);
    2. a lil messy, use DateFormatter to format the sql.Date, this gives you a Date in Strint form. Do remember the exact API for the DataFormater, but something like this.
    var mDate = new Date("<%= DateFormatter.format(myDate) %>");
    I'd prefer the 1st approach, why changing a Date to String then just change to Date again....Also watch out the TimeZone stuff and Daylight saving time....have fun.

  • Javascript function undefined error

    Hi developers,
    I am generating a html file on the fly using a perl program. The main form to be used is generated by a javascript function called loadPage(). loadPage writes the <form> <input type="checkbox"> blah..</form> into the document by using document.write When the checkbox is unchecked, a javascript function called delFromList is called. This function is generated when the html is generated(by the perl program). The problem now is that the form comes out well but when I uncheck the checkbox, the javascript error says delFromList undefined...the same problem occurs for each function call...what am I missing here...any help will be highly appreciated...
    tia.
    vish
    PS: the sample html is inlined below
    Content-type: text/html
         <html>
         <head>
         <title>Level Refinement</title>
         <script Language=JavaScript>
    function delFromList(box) {
    blah blah....
    function addToList(box) {
    blah blah....
    ....and many other functions...all function that are used are defined....
    function loadPage()
                        document.write("<form name=layout action=\"http://software.somesite.com:81/cgi-bin/parser.pl\" Method=post>");
              document.write("<INPUT TYPE=CHECKBOX NAME=\"European\" VALUE=\"European\" onClick=\"if(this.checked){addToRankList(this)}else{delFromRankList(this)}\" CHECKED>European<BR>");
              document.write("<INPUT TYPE=CHECKBOX NAME=\"Canadian\" VALUE=\"Canadian\" onClick=\"if(this.checked){addToRankList(this)}else{delFromRankList(this)}\" CHECKED>Canadian<BR>");
              document.write("<INPUT TYPE=CHECKBOX NAME=\"Japanese\" VALUE=\"Japanese\" onClick=\"if(this.checked){addToRankList(this)}else{delFromRankList(this)}\" CHECKED>Japanese<BR>");
              document.write("<h4>Rank your preferences:<ul type=circle><li> Select the attribute to move<li> Use the \"Move Up\" and \"Move Down\" buttons to move the attribute ranking HIGHER and LOWER respectively.<br></h4>");
              document.write("<div align=center><center><table width=100% border=1><tr><td width=30% valign=top align=center>Ranking (High to Low)<br><select name=col1 size=10 onChange=checkSelectCol1()>");
              document.write("<option>European");document.write("<option>Canadian");document.write("<option>Japanese");               
              document.write("</select><p>");
              document.write("<INPUT TYPE=button value=\"Move Up\" size=4 onClick=javascript:col1Up(document.layout.col1)>");
              document.write("<INPUT TYPE=button value=\"Move Down\" size=4 onClick=javascript:col1Down(document.layout.col1)>");     
              document.write("</td></tr></table></div><br>");
              document.write("<INPUT TYPE=button value=\"Next\">");     
              document.write("</form>");
         </script>
    </head>
         <body onload="loadPage()">
         </body>
         </html>

    As mentioned above javascript and java are 2 different thigns. How ever after looking at your code I would have to guess that you missed a '{' or '}' some where in you actual code. Other than some minor html syntax errors I realy didn't see anything wrong with the code above. But since you didn't post the actual code it hard to say if fixing the few minor errors would make any diff. I'm going with missed curly braces.
    Ron_W

  • Call javascript function dynamically

    Can this be done to call Javascript function dynamically? What I mean is suppose I use Javascript to submit form and target the reply to a popup window:
      function cForm() {
         win=window.open('','myWin','toolbars=0');
         document.aForm.q.value='12345';     
         document.aForm.target='myWin';
         document.aForm.submit();
      }I target the form reply to popup window myWin. Suppose the reply body contains some Javascript function doX(). Is it possible to call doX() automatically, after the submit and the reply is loaded on myWin, maybe using some onload event in the popup window?

    On the PopUo Windows BODY onLoad, call the method doX()

  • Passing a parameter to a javascript function

    I have declared a <jsp:usebean> on my jsp to extract a flag from the request. I want to then pass this String as a parameter to a javascript function called on the body onload. What is the best way of doing this? The javascript function is embedded in the jsp - does this mean I can access the variable directly, without even passing it as a parameter? do I use the <%= > syntax to reference the String on the onload? Do I use the <bean:write> the extract the varible within he javascript. Any help appreciated....

    JSP runs first on the server, and generates the HTML page with javascript.
    The javascript then runs on the client - it can't call any more JSP code, without submitting a request.
    In this case, you will want to use JSP to generate the javascript code that you need to run as a string on the page. You should probably use the <%= %> or the <bean:write tag>
    eg
      <script>
      <!--
        function loadForm(){
          var userName = "<%= user.getName() %>";
          alert("Hello " + userName);
      //-->
      </script>Note again. The use.getName() function will run on the server and produce static html/javascript like this
    var userName = "evnafets";
    JSP CODE DOES NOT RUN ON THE CLIENT. You cannot use JSP code to react to button clicks on the form for instance.
    Hope this helps,
    evnafets

  • Where to call the javascript function

    Hi,
    I am using JSF and ADF.
    I have a javascript function called by the body onload.
    The javascript is to set the first the first column of a table fixed.
    But when I click the next page link which is generated by defaut,
    the function from the javascript disappears.
    Can I call a javascript function when pressing the next page link which is
    generated by default ?
    Thanks.
    Ivan

    Hi Frank,
    My javascript function is to make the first column of the table fixed which
    is something like the function in the Excel.
    The function is called by body onload.
    But when the 'next page' link is clicked, it will not refresh the whole page.
    The above cannot be called.
    So I wanna add it during the action of pressing the link.
    any alternatives ?
    Ivan

Maybe you are looking for

  • My home button is broken and my iPod was accidentally shut off. Is there a way I can turn it back on with out it?

    My home button has been broken for almost 7 months, now, and I have been using the assistive touch, but, today, my roommate accidentally shut my iPod off using the Lock button, and now I cannot turn it back on. Is there a way to do this? Help!

  • Sales Invoice Issue

    Hello all, The case is if we are going to raise an Invoice for example of Rs. 100.50 and the amount recieved against this order is Rs. 100 the SAP would not permit us to invoice that particular order. Is there any method in SAP where we can define th

  • Where clause - parentheses versus view link

    I have detail View Object DetailVO with where clause "status=1 or status=2" and I add it to AM as detail of masterVO. Then the link doesn't work, I suppose BC4J create new where clause as "status=1 or status=2 and :1=....". But it means "status=1 or

  • OUTPUT OF TOKENS TO FILE

    Okay, I have a program which reads in a file, the contents of this file are then tokenized. I have a method to determine whether to keep the token or not. If I want to keep the token I write it to another file. But that is where my problem is. Each u

  • My 8310 randomly shuts down

    I have my phone fully charged and it will then randomly shut down.  The ONLY way to restart it is to plug it into the charger, the hourglass starts up and it takes a while to get back to "normal" . I think the only constant I can pick up is that the