Article View: borland.public.jbuilder.java.language
Article #15437Re: HELP...PASSING VARIABLES
From: Thai Huynh
Date: Fri, 11 Jun 1999 00:00
Date: Fri, 11 Jun 1999 00:00
58 lines
2708 bytes
2708 bytes
You can pass values to and from Javascripts and Applets by using the
applet's
function call.
In the Html file where the applet resides:
<script language=Javascript>
function toApplet()
{
document.fred.setValue(200)
}
function fromApplet()
{
var val = document.fred.getValue();
}
</script>
...
<applet code="app.class" name=fred>
</applet>
In the Class app.java:
----------------------
public int getValue()
{
int value = 2126;
return(value);
}
public void setValue(int newValue)
{
int valueFromHtml = newValue;
}
MJR <Rao.Mohith@compaq.com> wrote in message
news:7jp1de$9ul$1@mailint03.im.hou.compaq.com...
> I wrote an applet which needs a cookie-value located on the parent html
> file. Does anyone know how I could pass this value on to the applet. I
> tried:
> <applet code=..........>
> <param name=cookieVal value=GetCookie() >
> OR
> <param name=cookieVal value=userName>
>
> where GetCookie() is a java script method defined earlier which returns
the
> cookie value, and userName is a java script variable defined earlier which
> is the cookie value. But this stores "GetCookie()" and "userName"
> respectively as the parameter instead of the actual return value of the
> function/variable. I guess my question is, then, how you can call a
script
> function/variable from HTML.
>
> Any help would be much appreciated.
>
>
>
Technical Details
Message-ID:
<376058ca.0@news.camtech.net.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7jp1de$9ul$1@mailint03.im.hou.compaq.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d6b,b1b085475626e53b X-Google-Attributes: gid111d6b,public X-Google-Thread: 113ae9,b1b085475626e53b X-Google-Attributes: gid113ae9,public X-Google-Thread: 10bb9b,b1b085475626e53b X-Google-Attributes: gid10bb9b,public X-Google-Thread: fecd1,b1b085475626e53b X-Google-Attributes: gidfecd1,public X-Google-Thread: fa45f,b1b085475626e53b X-Google-Attributes: gidfa45f,public X-Google-Thread: f5d71,b1b085475626e53b X-Google-Attributes: gidf5d71,public X-Google-Thread: f74b3,b1b085475626e53b X-Google-Attributes: gidf74b3,public X-Google-Thread: 10a146,b1b085475626e53b X-Google-Attributes: gid10a146,public From: "Thai Huynh" <thuynh@sydac.com.au> Subject: Re: HELP...PASSING VARIABLES Date: 1999/06/11 Message-ID: <376058ca.0@news.camtech.net.au> X-Deja-AN: 488126604 References: <7jp1de$9ul$1@mailint03.im.hou.compaq.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Trace: 11 Jun 1999 10:01:06 +0950, bruce.sydac.com.au Organization: OzEmail Camtech Internet customer Newsgroups: borland.public.jbuilder.java.language,comp.lang.java,comp.lang.java.api,comp.lang.java.help,comp.lang.java.machine,comp.lang.java.misc,comp.lang.java.programmer,microsoft.public.inetexplorer.ie4.java_applets