Calling a javascript as an argument to window.open

can i pass a javascript function as an argument to window.open? i would like to call a function that submits my form.

Here are two hmtl pages that communicate between them:
x.html
<html><head>
<script>
function doX() { alert("here"); }
</script>
</head>
<body>
<form name='form1' >
<input type=text name='me'>
</form>
</body>
</html>
<script>
sList = window.open("xx.html", "list", "width=150,height=210");
</script>
xx.html
<script>
window.opener.document.form1.me.value="doX()";
window.opener.doX();
</script>

Similar Messages

  • How to return a javascript window.open object

    Hi all,
    I am calling a javascript function to create a window using the External Interface from flex. The function call works and I get a popup window, but I want to return the window.open object that I just created so that I reuse the same window again. I do not want to keep an array of window objects on the javascript side and pass an index back and forth. There will be multiple popup windows that needs to be written to.Right now the return value from the External Interface call is undefined.
    Thanks for any help here.
    Jerry

    Hmmm sound like somthing has gon wrong
    if it dont even work local you may have don somthing wrong when instaling the action ??
    is the action corectly placed in (GoLive Application Folder) / Modules / JScripts / Actions / ???
    What version of GL are you using ??
    Nate's FAQ on golive action:
    http://www.mindpalette.com/actions/faq.php#Anchor-47857
    "3. Why don't my third-party actions work in GoLive CS2?
    Because of a bug in GoLive CS2, the JavaScript code from some third-party actions is not automatically added to GoLive's external script library when first used (usually GeneratedItems/CSScriptLib.js at the top level of your GoLive site). To fix, open your GoLive site window and right click on the GeneratedItems/CSScriptLib.js file and choose Update > Flatten Script Library from the contextual menu.
    This will force GoLive to update the script library to include all used action code. Re-upload the file to your server and the action should be working again. You may need to clear your browser cache to force the new file to load if you've recently visited the page"
    Mayby others have had problem with his action to Try see his forum:
    http://www.mindpalette.com/forum/index.php
    you may also try this:
    1 Open the action as if its a normal document
    2 make a small change
    3 save
    4 change back /remove the change
    5 save
    6 restart golive

  • ExternalInterface.call Causes JAVASCRIPT ERROR??

    my AS3.0 is this:
    btn_mc.addEventListener(MouseEvent.CLICK,journey_popup);
    function journey_popup(e) {
    ExternalInterface.call("journey_wow_popup");
    my javascript is this:
    function journey_wow_popup () {
    window.open('journey_pricing.php','_blank',
    'height=200,width=350,status=yes,toolbar=no,menubar=no,location=no');
    My flash OBJET ID and movie name is "journey_wow"
    I get this javascript error when I click btn:
    Error: "journey_wow" is undefined
    I tried this on 4 computers, I never get the the error in FF,
    I got the error on 2/4 of the computers in IE and didnt get the
    Error in the other 2.
    So sometimes it works in IE and sometimes it doesn't. Also my
    flash element is not in a form.
    you can view it here:
    http://www.sussexjewelers.com/product.php?pid=1390
    (its the big red box with yellow star)
    Please help!!
    Thanks!

    Below is my embeding script, thanks.
    <script language="javascript">AC_FL_RunContent =
    0;</script>
    <script src="AC_RunActiveContent.js"
    language="javascript"></script>
    <script language="javascript">
    if (AC_FL_RunContent == 0) {
    alert("This page requires AC_RunActiveContent.js.");
    } else {
    AC_FL_RunContent(
    'codebase', '
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
    'width', '626',
    'height', '115',
    'src', 'journey_wow',
    'quality', 'high',
    'FlashVars',
    'journey_price=<?=round($prod_field['prod_price'][0])?>',
    'pluginspage', '
    http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'transparent',
    'devicefont', 'false',
    'id', 'journey_wow',
    'bgcolor', '#ffffff',
    'name', 'journey_wow',
    'menu', 'true',
    'allowFullScreen', 'false',
    'allowScriptAccess','always',
    'movie', 'journey_wow',
    'salign', ''
    ); //end AC code
    </script>

  • Javascript window.open call results in new window and not new tab.

    I'm creating an extension and using JS to open a new window. I've tried a variety of forms including something like: window.open("https://www.FOO.com" + dest,,"_newtab") and just window.open(url).. The option is set (tools/options) to open in a new tab. I've looked at preferences and forum suggestions to no avail. The proper url opens in a new window instead.
    I've disabled all other addons and plugins.
    I suspect I'm doing something silly, but would appreciate any insights.
    Thx, --Don

    Thanks for the reply. I'd seen those articles. AFAIK, the default settings are as they should be to open in a new tab (3 & 2 respectively). ...new_window.override.external = -1 though I don't know what that does or if it has any bearing on the issue.
    Thx, --Don

  • Javascript window.open needs to always open in a new window

    I am tring to create a menu system. When the user selects an item, then clicks Open Application, I want them to be able to open the application in a new browser window with specific window prefs.
    I have added this javascript to my page html header
    function launchAbout() {
    about = window.open("&P2_URL.", "CAT", "&P2_WINDOW_PREFS.");
    return false;
    I then have a html region with the source as:
    A HREF="&P2_URL." onClick="return launchAbout()" <img src=/i/ocpa/open_app.jpg></A>
    When I click on open app, the first time the app will open in a new window, but the second time it will just change the already open window to the new app. If I create new function then the new function call will open in the new window, but the next time it will just refresh.
    It seems like this function only opens a new window the first time it is called. Does anyone have any ideas how to open a new window every time?
    Edited by: user531645 on Sep 24, 2009 7:33 AM
    Edited by: user531645 on Sep 24, 2009 7:38 AM

    I was able to fix my problem. I had to change the java script to this:
    function launchAbout() {
    about = window.open("&P2_URL.", "_blank", "&P2_WINDOW_PREFS.");
    return false;
    }

  • Javascript Issues with 'javascript:window.open'

    Hi guys,
    Really hoping someone can help out here. To set the scene I have detailed a similar example from the OEHR Schema based on the EMP table.
    I have a page defined with a classic report with all the contents of the EMP table, for example :
    HIREDATE | SAL | COMM | DEPTNO | MGR | JOB | ENAME | EMPNO |
    I have edited the column EMPNO report attribute so i can create a link from the EMPNO column, in the Column Link section i have defined the following attributes :
    Link Text : #EMPNO#
    Target : URL
    URL : javascript:window.open('f?p=&APP_ID.:28:&SESSION.::NO::P28_EMPNO:#EMPNO#');
    So in the URL i call the javascript function to open a new window, passing the Application ID, Page 28, Session ID and a parameter for the EMPNO.
    So far this all works fine, the new page opens which is also defined with a report region, however this time i pass the parameter item P28_EMPNO into the SQL to return just that row. I understand that from a security stand point this is probably bad practise however, at the moment this appears to be the only way i've managed to figure out how to create a pop up window passing parameters.
    The problem though is the original APEX page must be doing some sort of branch when the EMPNO link is passed, as the page refreshes with the following :
    The actual URL used is : javascript:window.open('f?p=101:28:2506768909457997::NO::P28_EMPNO:7369');
    and the page just displays : [object Window]
    Hope this makes sense.
    Thanks in advance

    Report your problem to Apple here: http://www.apple.com/feedback/ipad.html

  • How to call that javascript file?

    I developed javascript for automated pdf files. But i don't know how to call that javascript file from outside of acrobat. Kindly advice me the various way to use that script. This is for acrobat 8.0 for windows platform.

    You can place Acrobat JavaScripts in various form elements, document actions, documents, and the application folder or user application folder. See the Acrobat JavaScript API Reference and Guide fo rmore information, http://www.adobe.com/devnet/acrobat/javascript.html .
    From within Acrobat's JavaScript's debugging console, one can use the following code to locate the JavaScript folders used by Acrobat/Reader:
    function JSInfo() {
    /* define function to report JS information */
    // some basic system information
    console.println(app.viewerType + ' ' + app.viewerVersion + ' is running on ' + app.platform);
    // user level script folder
    try {
    var userJS = 'User level JS folder: ' + app.getPath("user","javascript");
    } catch(e) {
    var userJS = "User has not defined use JS folder level scripts";
    console.println(userJS);
    // application level script folder
    try {
    var appJS = 'Application level JS folder: ' + app.getPath("app","javascript");
    } catch(e) {
    var appJS = "There are no defined application level JS folder level scripts";
    console.println(appJS);
    return;
    } // end of JSInfo function
    JSInfo(); // call the function

  • How do you call a JavaScript function from a Java applet

    I have an Applet that needs to run on the following platforms: Internet Explorer (Windows-NT, Windows -2000), Netscape (Windows-NT, Windows-2000, Sun(Solaris), RedHat(Linux), HP(11.0), IBM(AIX)).
    The Applet needs to call a JavaScript function that is included on the HTML page that contains the applet. In JRE-1.3.1 I used the AppletContext.showDocument(url,"_self" ) where the url is "javascript:MyScript('param1')". This works just fine. I tried using showDocument without the second parameter and all the other choices for the second parameter and none of them worked (nothing happened).
    I tried the same code with JRE version 1.4-beta. It seems that version 1.4-beta no longer supports a URL that starts with "javascript" in the AppletContext.showDocument(url,"_self" ) method. The error is:
    netscape.javascript.JSException: call does not support self.open
    at sun.plugin.javascript.navig.Window.call(Unknown Source)
    at sun.plugin.ActivatorAppletContext.showDocument(Unknown Source)
    I tried to catch the JSException but I cannot seem to.
    I then tried a completely different approach. I then grabbed the JSObject for the page and tried to call my javascript function (MyScript) directly:
    JSObject theObj = JSObject.getWindow(this);
    Object paramArray[] = new Object[1];
    paramArray[0] = Param1;
    theObj.call("MyScript", paramArray);
    This worked fine on Netscape[Windows-NT, Windows-2000]. HP throws a JSException on getWindow() and Solaris just hangs. I did not even try IE.
    What is the recommended approach here?

    you can try this, it worked for me:
    JSObject win = JSObject.getWindow(this);
    win.eval(function_call);
    I have other ways also, so if this doesn't work, let me know.

  • Calling a JavaScript function from an JApplet...

    Can anyone help? Is it possible to call a JavaScript function from within a JApplet? If so, what is the syntax? I've seen reference to the Netscape package but I've been led to believe it doesn't always work within Internet Explorer 6 which is the target browser.
    If the above is not possible can anyone tell me if and how it is possible to load images from outside the init() method of a JApplet? This would allow me to work around the problem.
    Thanks in advance - Jim.

    Call javascript you use the JSObject
    Please note the MAYSCRIPT int the html file.
    html file:
         <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
                  height="0" width="0" >
            <param name="code" value="someApplet.class" />
            <!--[if !IE]> Mozilla/Netscape and its brethren -->
            <object classid="java:someApplet.class"
                    height="0" width="0"
                    mayscript=true>
            </object>
            <!-- <![endif]-->
          </object>
    <LABEL id="lblOutputText">This text is the HTML text </LABEL>java class:
    // new class for jsObject!!!! compile this: javac -classpath "C:\Program Files\Java\jre1.5.0\lib\plugin.jar" someApplet.java
    // since jaws.jar does not exsist anymore
    // in 1.4.0 to compile: javac -classpath "C:\j2sdk1.4.0_03\jre\lib\jaws.jar" someApplet.java
    // for msjvm use the -source 1.3 -target 1.1 option so the command looks like this:
    // javac -source 1.3 -target 1.1 -classpath "C:\j2sdk1.4.0_03\jre\lib\jaws.jar" someApplet.java
    import netscape.javascript.*;
    public class someApplet extends java.applet.Applet {
        JSObject win;
        public void init() {
             try{
                 win = JSObject.getWindow(this);
    // you need win.eval("window.close();"); // to close the window. if the current window is not a popup
    // opened by a parent with window.open than the user will get a waring, your next question probably will
    // be "can I stop this warning" and the answer is simple: NO
                 JSObject textBoxLabel = (JSObject) win.eval("document.getElementById('lblOutputText')");
                 textBoxLabel.setMember("innerHTML", "<center><h1>Some text</h1></center>");
            }catch(Exception e){
                 e.printStackTrace();
    }

  • How to call a javascript function from XSL

    I'd a requirement to take an action each time a page loads
    I called the javascript function from addLoadEvent() available in javascript.
    But my reviewer commented that it should be called using XSL as we are using XSLT,
    What is preferred?
    To pass function name to the already available function or somehow call it from xsl ? if second is preferred option then,
    how to call a function through XSLT, if it is to be called aftr the page loads?

    Thank u..
    but i'd seen that link wen i searched in google..
    Is it possible without using any 3rd party JARs and all?
    and more importantly plz tell me what should be preferred way to call a javascript function?
    Do it using addLoadEvent() or Windows.Load etc
    OR
    Call it thru Xsl? (I donno how to do dis)
    Thanks in Advance..
    Edited by: ranjjose on Jun 3, 2008 8:21 AM

  • Does window.opener persist (javascript)?

    If a new popup (created from a parent window) uses window.opener, and the popup reloads itself when it's form is submitted to the same page by calling the same url (jsp) it was created with, does the window.opener retain it's handle on the parent window? Assume both the parent and the popup are never closed between submissions.
    In simple testing, I am finding that window.opener is in fact retained, and the popup can manipulate the parent window even after the popup is reloaded. Likewise, the parent window can still be manipulated from the popup when the parent is reloaded. But I just wanted to more sure before I incorporate this in a larger application, in case my simple test was some accidental fluke.
    I realize javascript variables are normally reloaded, but my initial testing suggests that the window.opener is a special persistant variable.

    Curt,
    In the DOM opener is a Window property, therefore, if neither window is closed, all of the window properties persist.
    Alex C.

  • Portal confused by window.open javascript command.

    To all,
    I am having difficulty trying to implement a javascript popup
    calendar. I am calliong a simple html page i have stored in
    avirtual direcytory on the web server. I have also moved it to
    the apache default html directory. When i issue the window.open
    command it open a new window but thinks the calendar.html is a
    procedure as i get the procedure not found error page. Can
    someone give me a hint here? Can i not call a html file from a
    form button. I am adapting an example from metalink for webdb.
    Any help would be appreciated.
    Thanks DaveT.

    hi,
    In portal, if you only include the filename in the hyperlink,
    such as xxxx, then it will be
    considered by portal as http://ip/pls/portal/filename.html. so
    if you want to show your file stored in a virtual folder
    like 'http://ip/virtual_folder' then you should give the href
    value in either of the following ways:
    1. 2. wish this would help.
    JC

  • SecurityManager different in init(), start() or when called by javascript

    I have an applet loaded via JNLP and running on jre 1.6.0_16 on IE7 or FF3.5 on Windows XP SP3 32bit.
    In this applet. JNLP file specify all-permission, but I am unsure if this tag is relevant to applet or only to application. Anyway, it is in the jnlp file. This jnlp file is not signed.
    Currently I am unsure about the SecurityManager that should control my applet. When I try to call File.createTempFile("aaaa", "bbb") in method init() ot start(), I get no problem at all: I create the file, I write to the file, I then delete it.
    Then, I do have a method being called from javascript. This new method cannot create any file since it always get a SecurityException.
    I am quite confident this is a bug, but I don't know what should be the correct behaviour.
    Any hint?
    Giuseppe

    So, it seems this is a known and expected behavior as discussed here:
         http://bugs.sun.com/view_bug.do?bug_id=6559401
         http://bugs.sun.com/view_bug.do?bug_id=5011139
         http://bugs.sun.com/view_bug.do?bug_id=5018024
    Bye,
    Giuseppe

  • Calls to JavaScript from Flash doesn't seem to work!!!

    Does anyone met this strange issue, the calls to JavaScript
    using getURL() doesn't work in IE (6.0.2900.2180). External
    Interface doesn't work either when trying to call some function
    defined in HTML-page body. Drives me crazy! HELP!!!

    Thanks! When page is loaded from the server everything works
    alright. But what to do when developing local browser-oriented
    applications? Gues this is some sort of security features that
    Windows or IE has acqured.

  • Window.open javascript on button causes parent window to display blank page

    In Captivate 3, I've created a Text button that executes the
    following Javascript:
    window.open('stakeholder_part2.htm','', 'fullscreen=yes,
    scrollbars=auto');
    The Javascript works perfectly, but when it executes, the
    page in the parent window goes blank except for the word "object"
    in square brackets. Hitting the back button in my browser navigates
    back to the Captivate movie.
    I've tried every combination of settings I can think of in
    the button dialog. Currently I have "top" selected in the window
    dropdown, and "Continue playing project" disabled. The only setting
    that didn't work at all is "New" ("Current" and "Parent" both
    generated the results described above).
    Could this have something to do with the fact that the
    javascript launches the new window in fullscreen mode?
    quote:
    Text

    You could try wrapping your function in a call to void(),
    which basically says "don't return a value when evaluating this".
    It would look like this:
    void(window.open('stakeholder_part2.htm','', 'fullscreen=yes,
    scrollbars=auto'));
    Unless you really want to open a different new window each
    time the function is called, you should also specify a name for the
    new window, as in:
    void(window.open('stakeholder_part2.htm','newWin',
    'fullscreen=yes, scrollbars=auto'));
    The browser will check for an open window with this name and
    show the page in that window if it's still open.

Maybe you are looking for