Javascript from Java - calling html control functions

i have called the attributes of an html control from java using this method
private JSObject iframeObject;
iframeObject=(JSObject)win.eval("parent.document.getElementById('"+popupIFrame+"')");
iframeObject.setMember("src", "../Applet/Popup.html");but how can i call the functions of a control
for example the focus() function of a textbox or someother controls???

its ok i got it.
win.eval() can do it

Similar Messages

  • How to call javascript from java application

    How can we call a function written in javascript from java application (core java not applet)? How will java identify javascript?
    Is there any such options ?

    Try creating a page called launcher.html (for example). That does this:
    <html>
    <head>
    <script language="javascript">
    windowHandle=window.open("http://www.javasoft.com", "", "height=700,width=1000,status=no,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,top=5,left=5");
    </script>
    </head>
    </html>Now you launch IE (or whatever) with this page using the Runtime class. After x seconds (after the second window has been launched) try killing the process. Hopefully it will kill the original window you opened and not the window you popup (the one without toolbars etc)
    It might kill both windows but I can't be bothered to test it. If it does you'll have to try and find a workaround.

  • Calling javascript from java

    I am not able get the javascript funtion executed.
    Pl. help me.
    A Javascript function is called from Java by using the showDocument method. A URL is needed with "javascript:" as the protocol.
    [Java applet] import java.applet.*;
    import java.net.*;
    public class inJava extends Applet{
    public void init(){
    String msg = "We will jump to an HTML tag";
    try {
    getAppletContext().showDocument
    (new URL("javascript:doAlert(\"" + msg +"\")"));
    getAppletContext().showDocument
    (new URL("javascript:jumpTo(\"#JUMP\")"));
    catch (MalformedURLException me) { }
    [Javascript and HTML] <HTML><HEAD></HEAD><BODY>
    <SCRIPT>
    function doAlert(s) {
    alert(s);
    function jumpTo(tag) {
    self.location=tag;
    </SCRIPT>
    <APPLET CODE="inJava.class"
    NAME="myApplet" MAYSCRIPT
    HEIGHT=400 WIDTH=10>
    </APPLET>
    <P>
    <A NAME="JUMP">jump here from Java via Javascript</A>
    </BODY>
    </HTML>
    Thanks
    vema

    Vema,
    you cannot go this way. Let me copy/paste the piece of my code:
    JSObject.getWindow( applet ).call( "open", new String[] { /* list of parameters of 'open()' function */ });
    vpanasenko_even

  • "ReferenceError: "myIpAddr"  is not defined, when call JavaScript from java

    Hi developers,
    My java application was trying to issue a http request via proxy auto-config. So, I did below jobs
    1. Read URL of *.pac from registry
    2. Call FindProxyForURL from java, the code is like below
                   ScriptEngineManager factory = new ScriptEngineManager();
                   ScriptEngine engine = factory.getEngineByName("JavaScript");
                   engine.eval(autoProxyScript);
                   Invocable inv = (Invocable) engine;
                   Object obj = inv.invokeFunction("FindProxyForURL",
                             "http://java.sun.com/",
                             "java.sun.com");
    However, I got "ReferenceError: "myIpAddress" is not defined
    I can not change the script on server to add a function like "myIpAddress", I am wordering why IE or mozilla can call it successfully and get proxy server, while Java failed to do that.
    I got a ugly solution by calling "pacparser" by jni. But I really hope I can get a better solution.

    A .pac file is a JavaScript, but it requires some functions to be defined in the executing context to work (i.e. you must define those).
    From the example on the Wikipedia page there's at least "shExpMatch" and "isInNet". "myIpAddress" seems to be another such candidate.

  • XML-Document from Internet via HTML-Control?

    Hi everybody,
    I would like to access an XML-document from the internet via a HTML-Control and save it in an ABAP XSTRING-Type so i can use the "call Transformation" in order to save it in an ABAP-Table. Is that possible?? or I have to use XI to access such XML-documents.
    Thanks
    Ihssan

    Hello Mr Raja,
    your answer was helpful. There is no problem by accessing XML data from 'http://'-address. But if i try to access the xml data from 'https://'-address it doesn't work. Of course i used a https sheme type.
    Is there problems by getting data from https??
    thanks in advance
    Ihssan
    p.s.: sap_basis release 6.20

  • Attribute support when transferring from Java to HTML in CF9

    CF beginner.
    When transferring from flash to HTML format, is there a way to control attributes which are not accessible through tags (for example HSCROLL and WIDTH in CFTREE)? Seems like going modifying the Ext JS object is the only way (for example using ColdFusion.Grid.getGridObject) as described in CFML reference but this apparently only works for editable objects. Is this the correct approach? Are there other ways of doing this? staying with a non-HTML format is not an option and so any help is greatly appreciated
    Disclaimer: just starting with CF and haven't had a chance to try these things in practice.

    As TD said... and you could upgrade to iPhoto 9 for $15 from the Mac App Store . Are your captions worth $15?
    One thing to note: Upgrading your library from 2005 to the latest iPhoto won't necessarily be without issues either although iPhoto 9 has been out for awhile and most of the bugs should be worked out by now.

  • Accessing ServletContext from Java class Data Control

    I'm writing some business service classes as plain old java classes that will be bound to a JSP using ADF and STRUTS. The business logic requires the real path of the servlet context to access a file. How do I call servletContext.getRealPath("/WEB-INF/test.xml")?
    I know this is mixing web tier code into model code, but I don't know any other way to do this.
    Thanks in advance...

    Ok, it looks like I'll have to define my own action class and pass the pathname on to the data control class.

  • Javascript from java

    hi
    when i tried to call a javascript method with an alert(), im getting the following error....But println() is working fine for me
    plz help me
    08/01/31 14:21:51 javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "alert" is not defined. (<Unknown source>#3) in <Unknown source> at line number 3
    08/01/31 14:21:51      at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:184)
    08/01/31 14:21:51      at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(RhinoScriptEngine.java:142)
    08/01/31 14:21:51      at testbuiltin.backing.Show_alert.show(Show_alert.java:66)
    08/01/31 14:21:51      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    08/01/31 14:21:51      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    08/01/31 14:21:51      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    08/01/31 14:21:51      at java.lang.reflect.Method.invoke(Method.java:597)
    08/01/31 14:21:51      at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
    08/01/31 14:21:51      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
    08/01/31 14:21:51      at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
    08/01/31 14:21:51      at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1213)
    08/01/31 14:21:51      at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
    08/01/31 14:21:51      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:448)
    08/01/31 14:21:51      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
    08/01/31 14:21:51      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:497)
    08/01/31 14:21:51      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:226)
    08/01/31 14:21:51      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:140)
    08/01/31 14:21:51      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
    08/01/31 14:21:51      at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    08/01/31 14:21:51      at oracle.adfinternal.view.faces.webapp.rich.SharedLibraryFilter.doFilter(SharedLibraryFilter.java:137)
    08/01/31 14:21:51      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:285)
    08/01/31 14:21:51      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:60)
    08/01/31 14:21:51      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:285)
    08/01/31 14:21:51      at oracle.adfinternal.view.faces.activedata.ADSFilter.doFilter(ADSFilter.java:76)
    08/01/31 14:21:51      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:285)
    08/01/31 14:21:51      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:209)
    08/01/31 14:21:51      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:166)
    08/01/31 14:21:51      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
    08/01/31 14:21:51      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    08/01/31 14:21:51      at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:619)
    08/01/31 14:21:51      at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)
    08/01/31 14:21:51      at com.evermind.server.http.HttpRequestHandler.doDispatchRequest(HttpRequestHandler.java:889)
    08/01/31 14:21:51      at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:797)
    08/01/31 14:21:51      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:607)

    check out apache rhino

  • How can I compile Javascript from Java??

    Hi all,
    I am facing a problem, problem is I have to compile JavaScript code in Java. JavaScript code will given in Text field, those code i have to compile and i should display a message saying this is valid Java script code or Invalid code.Can anyone help on this...

    JavaScript code interpreting but not compiling... I need to compile, but not Interpret the code. How can i Compile the JavaScript Code...

  • Values from Java Applet - Html

    Does anyone know a quick, effective way to export field values in java to an HTML form? Thanks. Charles

    You could use reflection: thsi would allow you to get the list of all the fields in an object you hold.
    For example say you have a servlet ExportValuesServlet and you want it to output the field values of object publishedObject.
    No matter what type publishedObject is, you could try, in the doGet method of ExportValuesServlet:
    import java.lang.reflect.*;
    doGet() { ....
    PrintWriter out = new PrintWriter (response.getOutputStream());
    try {
    Class class = publishedObject.getClass();
    Field fields = class.getFields();
    for (int=0; i<fields.length; i++) {
    Object value = fields.get(publishedObject);
    out.println(fields[i].getName() + "= " + value.toString());
    catch (Exception e) {
    System.err.println(e.getMessage());
    e.printStackTrace(System.err);

  • Javascript to Java (Applet) method call fails in JRE1.4.1 & NN4.79

    Win2k, Netscape 4.79, JRE 1.4.1. I'm trying to call an applet method from Javascript from the page which contains the applet. 'm using MAYSCRIPT tag. I'm getting the error "myApplet doesn'nt have any properties". (myApplet is the name of the applet). When I use the default JRE which is supported by NN4.79(Symantic JRE 1.1.5) it works well. Does JRE1.4.1 plugin doesn't support Javascript to Java calls? OR I'm doing something wrong.
    Deepak

    I'm seeing the same issue. This is supposed to work. I converted the <APPLET> tags in the HTML to use <OBJECT> and <EMBED> tags using Sun's converter (see http://java.sun.com/j2se/1.4/docs/guide/plugin/developer_guide/using_tags.html). I try to reference the applet (using the document.embeds[0] object instead of the document.applets[0] object) and it seems the applet has not been loaded. I can't reference any of the methods in the applet. It appears the applet has not loaded. I do not see any evidence of the applet's init() method being called.
    Have you had any luck getting this to work?

  • Calling c method from java

    Hi,
    I am new to JNI. I want to call a C function from java, where my C function name is
    UINT8 abc(UINT8 feature, UINT8* in_value, UINT32 serialNo, UINT8 * out_value)
    where,
    typedef unsigned char UINT8;
    typedef unsigned int UINT32;
    My question is what should be the prototype defination in java and what has to be changed in C code to make it work?

    After adding the native keyword to your Java method, compile with javac and run javah on the class name. For example:
    package my.stuff;
    public class MyClass
       public native void myMethod(char param1, int param2);
    }javac ./my/stuff/MyClass.java
    javah my.stuff.MyClass
    This generates my_stuff_MyClass.h, which has the function prototype for your method. Inside the implementation of the function, you can call your C function.
    Here is the contents for my_stuff_MyClass.h:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class my_stuff_MyClass */
    #ifndef _Included_my_stuff_MyClass
    #define _Included_my_stuff_MyClass
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     my_stuff_MyClass
    * Method:    myMethod
    * Signature: (CI)V
    JNIEXPORT void JNICALL Java_my_stuff_MyClass_myMethod
      (JNIEnv *, jobject, jchar, jint);
    #ifdef __cplusplus
    #endif
    #endif

  • Problem invoking Javascript from applet

    Hi,
    I have a hidden iframe in my JSP. While submitting the form within the JSP, I set the target of the response page as the iframe and disable all the form elements in the JSP . The response page contains an applet that pops up a window(a JFrame). On pressing the close button of the applet's frame, I invoke a Javascript method in the JSP. This javascript method enables all the components on the JSP.
    Now the issue is that, when I press the close button, the browser just hangs... This doesn't happen on all the browsers.. It works with Opera. In IE it doesn't work all the time. Some times IE just hangs... Any idea what the issue could be?? Pls let me know if the problem is not clear..
    Thanks in advance..
    regards,
    Anand

    Funny I've just posted something about this on another thread.
    http://forum.java.sun.com/thread.jsp?forum=54&thread=157547
    You can apparently call methods on your applets from javascript.
    http://developer.netscape.com/docs/manuals/communicator/jsguide4/livecon.htm#1007749
    I know that most of the LiveConnect package works in NS4, NS6, IE4 and IE5, but I have always called out to JavaScript from Java not the other way around so I cannot vouch for this in IE.

  • Java call out in OSB 10g

    in java call out in OSB, is it possilble to pass java object or java collection (like list,arraylist) as argument to the java method and during configuration at OSB proxy service is it possible to fetch the value from java object from java call out .I have tried it and i am able pass string and xml object as argument and get string type only.please guide me.

    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/pojo.html
    "The input and return types for Java callouts are not restricted. However, any return types other than primitives, Strings, or XmlObjects can only be passed (unmodified) to other Java callouts. See Java Content in the body Variable for more information about storing and passing Java objects in the pipeline."

  • JavaScript to Java with the Java Plugin, anyone?

    The java.sun.com web site seems to be teeming with docs on how to access JavaScript from Java, and the Netscape site seems to have plenty of docs on how to access Java methods from JavaScript using the browser's own JRE.
    But can one use JavaScript to access methods of a Java applet running under the Java Plugin? And if so, how?

    all the public methods and fields of an applet are exposed to javascript. In the <applet> tag, set...
    <applet ...otherinfo... mayscript></applet>, or
    <applet ...otherinfo... mayscript="true"></applet>
    I think the latter version is safer to use, as I think IE has issues if you just use the mayscript tag without the "true" value.
    So if that is set, in javascript all you have to do is address the applet, and call any of its public fields/methods. (Actually, I know you can call all public methods and I think you can call all the public fields as well...)
    var applet = self.document.applets[0];So now you can call all the public members, such as...
    applet.start();
    applet.stop();
    applet.myPublicFn1();
    applet.myPublicFn2(arg1, arg2);
    var val = applet.pubField1;etc.
    Note that if you're using Java2 (swing) thru the object/embed tags rather than just using the applet tag, things don't work that smoothly. I tried once and the applet wasn't actually found in the applets collection of the document. I tried finding the 'applet' object but had no such luck...
    Hope that helps.
    Good luck.

Maybe you are looking for

  • Help please! itunes wont open

    i am using a windows XP and my itunes will not open. I have uninstalled and reinstalled itunes and quicktime numerous times and itunes will still not open. Quicktime opens fine. I have also opened my Task Manager and itunes appear under processes but

  • A few queries regarding the beauty that is Nokia 5...

    I got this beautiful lil machine a lil over a week back. It looks lovely, and sounds even better. And even though, being a student/intern, it cost me more than my monthly salary, I am mighty pleased I got it. And despite the opposition before, it's a

  • Has Anyone bought this battery?

    This new Newer Tech battery. Has someone bought it and used it? How does it compare to the original Apple battery.. Use? And fit/finish? https://eshop.macsales.com/item/Newer%20Technology/BAP15AL5000/ I need a new battery or my 1.67 AL PowerBook

  • Does siri respond to multiple users's voices

    On I-Phone 4s, Does siri respond to multiple users' voices?

  • I need a new computer

    Ok i have a really crappy computer and i new a new one for between 800 - 900$. All i want is a reliable computer with the ablity to run the internet FAST.  Good grafics card with a Blu - Ray player.