java用户名按钮代码 Java按钮

Java中按钮事件代码

加入在frame中的按钮名为sure

站在用户的角度思考问题,与客户深入沟通,找到盐城网站设计与盐城网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站制作、成都网站建设、外贸营销网站建设、企业官网、英文网站、手机端网站、网站推广、主机域名、网页空间、企业邮箱。业务覆盖盐城地区。

Button sure=new Button("确定");

sure.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent evt)

{

frame1.setVisible(false);

Frame frame2=new Frame();

frame2.setVisible(true);

}

});

用JAVA如何制做一个简单的登录界面?就是有用户名、密码、确定和取消按钮、最好有注册按钮。给代码。谢谢

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

html

head

title无标题文档/title

script language="javascript"

function fsubmit(obj)

{

obj.submit();

}

function freset(obj){

obj.reset();

}

/script

/head

body bgcolor="#333333"

form id="form1" name="form1" method="post" action="conn.jsp"

table width="745" border="0" align="center"

tr

td width="100" /td

td /td

td width="104" /td

/tr

tr

td /td

td width="527" height="297" background="img/LoginBg.jpg" bgcolor="#F0F0F0"

table width="358" border="0"

tr

td width="70" height="51" /td

td width="119" /td

td width="160" /td

/tr

tr

td height="46" /td

tdfont color="#FFFFFF"用户名:/font/td

tdinput type="text" name="user" style=" width:160px" id="user" //td

/tr

tr

td height="34" /td

tdfont color="#FFFFFF"密  码:/font/td

tdinput type="password" name="pswd" style="width:160px" id="pswd" //td

/tr

tr

td height="24" /td

td /td

td /td

/tr

/table

table width="396" border="0"

tr

td width="82" height="30" /td

td width="114"img src="img/loginbutton.jpg" style="cursor:hand;" onclick="javascript:fsubmit(document.form1);"/td

td width="41" /td

td width="141"img src="img/canclebutton.jpg" style="cursor:hand;" onclick="javascript:freset(document.form1);"/td

/tr

/table /td

td /td

/tr

tr

td /td

td /td

td /td

/tr

/table

/form

/body

/html

%@ page language="java" import="java.util.*" contentType="text/html;charset=GB2312" import="java.sql.*"%

%@ page import="com.microsoft.sqlserver.jdbc.SQLServerDriver" %

%@page import="java.sql.DriverManager"%

HTML

HEAD

/HEAD

body

%

String userName=request.getParameter("user");

String Pswd =request.getParameter("pswd");

try

{

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();

}

catch(ClassNotFoundException e)

{

out.print("0");

out.print(e.toString());

}

try

{

Connection con=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=RegUser","sa","123");

Statement stmt = con.createStatement();

String sql="select * from tb_user";

ResultSet rs=stmt.executeQuery(sql);

while(rs.next())

{

if(userName.equals(rs.getString(2))Pswd.equals(rs.getString(3)))

{

rs.close();

stmt.close();

con.close();

%

jsp:forward page="index.html" /jsp:forward

%

}

}

rs.close();

stmt.close();

con.close();

%

script type="text/javascript"

if(!confirm("用户名或密码错误,是否要转入注册页"))

{

location.href="MyHtml.html";

}

else

{

location.href="Register.html";

}

/script

%

}

catch(Exception e)

{

out.print("1");

out.print(e.toString());

}

%

/body

/HTML

求java语言的一个按钮登录代码

点击进入js,将user和pwd通过ajax调用后台java代码去判断并根据返回值判断正确则window.location.href打开新的页面

java 在网页上添加用户名和密码输入框,以及登录按钮(不要求实现登录功能),

!DOCTYPE html

html

head

title登录/title

/head

body

form onsubmit="return check()"

label用户名/labelinput id="username" type="text" name="username"

label密码/labelinput id="password" type="password" name="password"

input type="submit" value="登录"

/form

script type="text/javascript"

function check(){

var username = document.getElementById("username").value;

var password = document.getElementById("password").value;

if(!username){

alert("用户名不能为空!");

return false;

}

if(!password){

alert("密码不能为空!");

return false;

}

return true

}

/script

/body

/html


新闻名称:java用户名按钮代码 Java按钮
新闻来源:http://lszwz.com/article/doocgcs.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款