Hi All,
     Ashwani, thanks for your reply.

     Coming to my problem, I have the following two files.
When I call my html file from Internet Explorer, I am getting the following
error: 'document.myform.test.getMonth()' is not an object.

Can any body tell me how to correct this problem?

I have generated a simple applet through Jdeveloper.

Bye
KV Srinivas Kumar


temp.html
~~~~~~~
 <html>
 <head>
 <script language="javascript">
 var strMon;
  function getMon(){
   strMon=document.myform.test.getMonth();
   alert("mon" + strMon);
 }
 </script>
 </head>
 <body>
 <form name="myform">
 <applet name="test" code="rob.class" width=1 height=1>
 </applet>

 <input type=text name=textfield1 value="">
 <input type=button onclick="getMon()">
 <form>
 </body>
 <html>


APPLET: rob.java
~~~~~~

package package1;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import oracle.jdeveloper.layout.*;

public class rob extends Applet {
  XYLayout xYLayout1 = new XYLayout();
  boolean isStandalone = false;
//Get a parameter value

  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  }

  //Construct the applet

  public rob() {
  }
//Initialize the applet

  public void init() {
    try {
    jbInit();
    }
    catch (Exception e) {
    e.printStackTrace();
    }
  }
//Component initialization

  private void jbInit() throws Exception {
    xYLayout1.setWidth(400);
    xYLayout1.setHeight(300);
    this.setLayout(xYLayout1);
    this.setBackground(SystemColor.control);
  }
//Get Applet information

  public String getAppletInfo() {
    return "Applet Information";
  }
//Get parameter info

  public String[][] getParameterInfo() {
    return null;
  }

  public String getMonth() {
    return "HELLO!!! I am from Applet";
  }
}




[EMAIL PROTECTED] on 03/08/2000 11:47:55 AM

To:   Srinivas Kumar Krishna Vajjala/BS1/SGSSDI/SONYASIA
cc:   [EMAIL PROTECTED]
Subject:  RE: Java in javscript




You can use the applet object of the javascritpt to access the
variables.For
applets , you can use the client side javascripting. but for normal java
class function you have to write server side equivalent of the javascript
may be using the liveconnect as you mentioned.


Ashwani Kalra
Sr. Systems Associate,
NIIT LTD.


> ----------
> From:   K.V.Srinivas Kumar
> Reply To:    [EMAIL PROTECTED]
> Sent:   Monday, March 06, 2000 10:15 AM
> To:     [EMAIL PROTECTED]
> Subject:     Re: Java in javscript
>
>
>
> Hi All,
>
>      Do we need to have live connect or something equivalent to call Java
> methods in JavaScript?  I have tried with the code as mentioned in the
> mail
> using internet explorer.  But I am getting javascript error message.
When
> I tried
> to access public string attribute of the applet class, I am getting the
> message:
>
>      undefined
>
> So I want to know what are the pre-requisite to communicate with java
from
> javascript.
>
> Thanks
> K.V. Srinivas Kumar
>
>
>
>
> sampathkumar rangarajan <[EMAIL PROTECTED]> on 02/29/2000 05:10:31
> PM
>
> Please respond to sampathkumar rangarajan <[EMAIL PROTECTED]>
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: Srinivas Kumar Krishna Vajjala/BS1/SGSSDI/SONYASIA)
> Subject:  Re: Java in javscript
>
>
>
>
> Hi,
>
> here is the code for calling java function from js.
>
> <comment>
>   Refers to MyApp.java  file
> </comment>
> <html>
>  <head> <title>  Accessing Java Applets from
> JavaScript </title>
>  <script language="JavaScript">
>    function call(str)
>     {
>      window.document.app.changeText(str);
>     }
>
>  </script>
>  </head>
> <body>
>
>  <applet code="MyApp.class" width=400 height=300
> name="app">
>  </applet>
>
>  <form name=frm>
>   <input type=text name=txt value=" " >
>   <input type=button name=btn value="Click"
> onClick='call(document.frm.txt.value)'>
>  </form>
>
>
> </body>
> </html>
> the applet file is
> //  JAVASCRIPT TO JAVA COMMUNICATIONS
>   import java.awt.*;
>   import java.applet.*;
>
>   public class MyApp extends Applet
>    {
>     String str="LiveConnect in Applet";
>     Font f = new
> Font("TimesRoman",Font.BOLD+Font.ITALIC,20);
>
>     public void init()
>      {
>       setBackground(Color.red);
>       setForeground(Color.white);
>       setFont(f);
>       resize(399,300);
>      }
>     public void changeText(String s)
>      {
>       str = s;
>       repaint();
>      }
>
>     public void paint(Graphics g)
>      {
>        g.drawString(str,10,100);
>      }
>
> if found this code useful i will be very happy.
>
> --- [EMAIL PROTECTED] wrote:
> > Hi,
> > Thanks, can you just send me a simple code exmple
> >
> > Ashwani
> >
> > > ----------
> > > From:       sampathkumar rangarajan
> > > Sent:       Monday, February 28, 2000 11:28 PM
> > > To:         [EMAIL PROTECTED]
> > > Subject:    Re: Java in javscript
> > >
> > > Hi,
> > >
> > > It is possible to call a java function from
> > > javascript.
> > > try a concept called liveconnect in javascript.
> > > if cannot mail me i will send the code.
> > >
> > >
> > >
> > > --- Ashwani Kalra <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > > I also want to know if this is possible. Does
> > > > javascript recognises the
> > > > return values from java functions. or is it
> > possible
> > > > to call the java
> > > > function inside the javascript. I have not tried
> > ,
> > > > but my guess is that it
> > > > will give you some kind of syntax error.
> > > >
> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > ASHWANI KALRA
> > > > NIIT LTD.
> > > > E-Commerce Group, SEB
> > > > 8, Balaji Estate
> > > > Kalka ji,
> > > > New Delhl-19.
> > > > Email : [EMAIL PROTECTED]
> > > >            [EMAIL PROTECTED]
> > > > Phone :091-11-6203577(D),6203578
> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >
> > > >
> > > >
> > > >
> > > > > ----------
> > > > > From:         meera nayak
> > > > > Reply To:     meera nayak
> > > > > Sent:         Thursday, February 24, 2000 1:44
> > PM
> > > > > To:   [EMAIL PROTECTED]
> > > > > Subject:      Java in javscript
> > > > >
> > > > > Hi room,
> > > > >             I am doing something like this
> > .Trying
> > > > to call a method in a
> > > > > java class from javascript.It returns a string
> > > > .But how does javascript
> > > > > handle it.Can it handle a parameter returned
> > from
> > > > the java method.Can it
> > > > > store it in a variable.
> > > > >
> > > > > source code
> > > > > <html>
> > > > > <head>
> > > > > <script>
> > > > > var strMon;
> > > > >  function getMon(){
> > > > >   strMon=document.test.getMonth();
> > > > >   alert("mon",strMon);
> > > > > }
> > > > > </script>
> > > > > </head>
> > > > > <body>
> > > > > <applet name="test" code="rob.class" width=1
> > > > height=1>
> > > > > </applet>
> > > > > <form>
> > > > > <input type=text name=textfield1 value="">
> > > > > <input type=button onclick="getMon();">
> > > > > <form>
> > > > > </body>
> > > > > <html>
> > > > >
> > > > > Can anyone help
> > > > >
> > > > > Thanx in advance
> > > > > Meera
> > > > >
> > > > >
> > > >
> > >
> >
>
==========================================================================
> > > > > =
> > > > > To unsubscribe: mailto [EMAIL PROTECTED]
> > with
> > > > body: "signoff
> > > > > JSP-INTEREST".
> > > > > FAQs on JSP can be found at:
> > > > >  http://java.sun.com/products/jsp/faq.html
> > > > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > > > >
> > > >
> > > >
> > >
> >
>
==========================================================================
> > > =
> > > > To unsubscribe: mailto [EMAIL PROTECTED]
> > with
> > > > body: "signoff JSP-INTEREST".
> > > > FAQs on JSP can be found at:
> > > >  http://java.sun.com/products/jsp/faq.html
> > > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > > >
> > >
> >
> ____________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.co.uk address at
> > http://mail.yahoo.co.uk
> > > or your free @yahoo.ie address at
> > http://mail.yahoo.ie
> > >
> > >
> > >
> > Visit http://www.niit.com for eCommerce Solutions.
> >
> >
> >
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
>
>
==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to