Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript question: initialising an applet from inside a function

Status
Not open for further replies.

emmyie2000

Programmer
Mar 17, 2001
3
IE
Hi there,
I was wondering if it's possible to initialise an applet from within a Javascript function. I'm trying to set up a submit button so that when clicked it will trigger the applet to run on that page. Here is what i have so far:


<SCRIPT LANGUAGE=&quot;JAVASCRIPT&quot;>
<!--
function submit()
{
document.write(&quot;Parsing Java program.......&quot;)
//initialise Applet here??!!
document.write('<APPLET CODE = &quot;blah.class&quot;>')
}

//-->
</SCRIPT>




<DIV ID = &quot;second&quot;>
<FORM>
<CENTER><B>Click submit to run the parser on your chosen Java program <BR>
<INPUT TYPE = &quot;SUBMIT&quot; VALUE = &quot;SUBMIT&quot; onClick = &quot;submit()&quot;></B></CENTER>
</FORM>
</DIV>
<BR><BR>


Will this approach work?? Also is it possible to do this if the program running in the applet takes another program as input?? i.e. the user browses for a java program in their directory, and then clicking submit triggers the running of the applet program based on that input program???
using the <PARAM TYPE> tag??

Any help would be appreciated.
Thanks a lot.
 
Wow, I really don't follow most of your question.

1) Applets can be scripted.

2) It may be possible to re-write you page from client script and force the browser to go to the server and get the .class files and launch the Applet.

3) While #2 might be possible, I believe there are much simpler solutions to your problem, but of course that is just a guess since you did not explain the problem you are trying to solve.

&quot;But, that's just my opinion... I could be wrong&quot;.
-pete
 
Ok I'll try and explain what I am trying to do. I have written a Java program that takes another Java program as input and parses it for syntax errors. What I would like is to set up a web page that allows the user to browse for a Java program on their directory (this part works!!) and then click a submit button that triggers the Java program to run on their input. I would like for the output to appear in an applet window but I'm not sure if this is possible??

I would appreciate any help.
Thnks a lot


 
Can anyone help me with this??? please????
thanks a lot :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top