Java获取Html变量的值
发表于:2007-07-04来源:作者:点击数:
标签:
Author: Tansf 代码如下 //------getParameter. java import java.awt.*; import java.applet.*; public class getParameter extends Applet{ private String title; public void paint(Graphics g){ title=getParameter(title); g.drawString (Hello World!,
Author: Tansf
代码如下
//------getParameter.
javaimport java.awt.*;
import java.applet.*;
public class getParameter extends Applet{
private String title;
public void paint(Graphics g){
title=getParameter("title");
g.drawString ("Hello World!",20,20);
g.drawString ("getParameter: "+title,20,50);
}
}
//----------getParameter.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>tansf</title>
</head>
<body>
<applet code="getParameter.class" width="210" height="118">
<param name="title" value="tansf">
</applet>
</body>
</html>
以上代码从htm文件中获取title的值
原文转自:http://www.ltesting.net