|
-
Mar 4th, 2003, 05:17 PM
#1
Thread Starter
PowerPoster
Call Applet functions from website (js?)
How can I call a function and pass parameters to a applet from my website? For example I want the user to enter name and password into textboxes and then click a button which calls the function login(name, pw) from my java applet. Best would be something using POST/GET but a javascript would also work..
There are several things why I don't want the textbox to be in the applet so please show me how to make website and applet work together,
Thanks
-
Mar 5th, 2003, 07:07 PM
#2
Thread Starter
PowerPoster
no one? I just need to get homepage and applet work together!
-
Mar 5th, 2003, 10:29 PM
#3
Addicted Member
no one's replying and i don't know much about applets. but i'll give it a shot.
under the Applet there is a method called getParameter
http://java.sun.com/j2se/1.4/docs/ap...l#getParameter(java.lang.String)
i'm not sure, but if you could use that to pass in whatever info you need to be passed.
the api explains how it's used. check it out. goodluck
--770
-
Mar 6th, 2003, 09:12 AM
#4
Thread Starter
PowerPoster
Nope that's only to read parameters from the website code..
<param name="text" value="hello world">
this one..
-
Mar 6th, 2003, 11:11 AM
#5
Addicted Member
hmm...
have you browsed the api for more methods?
i just though of this. use php to get the input, put it in a cookie and read the cookie from the applet.. (although i'm not sure if that's possible)
i'm just spitting out possibilies.
--770
-
Mar 6th, 2003, 11:30 AM
#6
Frenzied Member
Are you looking for something like this??
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function send_request(objForm)
{
var name = objForm.userid.value
var pw = objForm.passwd.value
// you might want to do some edits here, i.e.
if (name.length == 0)
{
alert('Userid required') // displays in a message box
objForm.userid.focus()
return
}
if (pw.length == 0)
{
self.defaultStatus = 'Password required' // displays in the status bar
objForm.passwd.focus()
return
}
document.myJavaApplet.login(name, pw)
}
// End -->
</SCRIPT>
</HEAD>
<FORM>
<BODY>
<!-- Note: HEIGHT="1" WIDTH="1" hides the applet -->
<APPLET NAME="myJavaApplet" CODE="myApplet.class" HEIGHT="1" WIDTH="1"> </APPLET>
<INPUT TYPE="TEXT" NAME="userid" SIZE="8">
<INPUT TYPE="TEXT" NAME="passwd" SIZE="8">
<INPUT TYPE="BUTTON" NAME="login" VALUE="Login" ONCLICK="send_request(this.form);">
</BODY
</FORM>
</HTML>
-
Mar 7th, 2003, 07:00 AM
#7
Thread Starter
PowerPoster
Eeeeeeeexactly, thanks loads!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|