Java获取Html变量的值
2008-01-05 18:45:47 来源:WEB开发网核心提示:Author: Tansf代码如下//--getParameter.javaimport java.awt.*;import java.applet.*; public class getParameter extends Applet{ PRivate String title; public void pai
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!",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的值
更多精彩
赞助商链接