How can I pass value from javascript to java applet? -
import java.awt.*; import java.applet.*; public class myapplet extends applet{ /** * */ private static final long serialversionuid = 1l; string dstring = "value null"; string gpath=""; public void get_path(){ gpath = this.getparameter("path"); if(gpath == null) gpath = dstring; //setbackground(color.cyan); } public void paint(graphics g){ g.drawstring(gpath, 20, 30); } }
html code:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"/> <title> upload file </title> <script type="text/javascript"> var sys_path; function print_path(){ sys_path = document.getelementbyid('name').value; document.app.get_path(); document.write(sys_path); } </script> <applet code="myapplet.class" name="app" width="300" height="200"> <param name="path" value="&{sys_path};"> </applet> </head> <body> <form> path:<input type="text" id="name" \> <input type="button" value="click" onclick="print_path();" /> </form> </body> </html>
explanation:
in these code i'm trying take input text box , display in applet. i'm trying couple of days , unable find way. please me regarding this. in advance!