Collecting Parameters with JavaScript
Applet Name: js.class
Description: Parameters passed to applet from input taken through use of JavaScript. Inspect source code!

import java.applet.*;
import java.awt.*;

public class js extends Applet {
     Font f = new Font("TimesRoman",Font.BOLD,12);
     String x,y,z;
     Dimension s;

     public void init() {
         x=getParameter("n");
         y=getParameter("v");
         z=getParameter("a");
         s=size();
         x="The "+z+" "+x+" is "+y+".";
         y="Have you been "+y+" very long?";
         z="Does your mother know about your "+z+" habit?";
      }

     public void paint(Graphics g) {
          g.setFont(f);
          g.setColor(Color.green);
          g.fillRect(0,0,s.width,s.height);
          g.setColor(Color.black);
          g.drawString(x,10,50);
          g.drawString(y,10,110);
          g.drawString(z,10,170);
      }
}


JavaScript: You will notice that this applet is loaded using JavaScript and that the values for the parameters are collected as input using alert boxes called from that same JavaScript function. You will notice that the parameter names are referenced by the getParameter method, but the values are stored as strings with different names in the applet.
Concatenation: Combining the contents of two strings or adding the contents of one string to the end of another. You will notice how the plus sign is used to concatenate several strings in this example.