电子商务ASP动态登录界面源代码
ASP动态商务网站登录界面源代码<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>通用登录系统</title>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<script language="jscript">
<!--
function Check()
{
var NotNull
NotNull=true
if (document.Login.UID.value=="")
{
window.alert("请输入姓名")
NotNull=false
}
if (document.Login.PWD.value=="")
{
window.alert("请输入密码")
NotNull=false
}
return NotNull
}
//-->
</script>
<style type="text/css">
<!--
a:visited,a:link { text-decoration: none; color: #003399}
a:hover { text-decoration: none; color: #3333FF}
a.linkwhite:link,a.linkwhite:visited { text-decoration:none; color:white}
a.linkwhite:hover { text-decoration: underline; color:white}
a.linkblack:link,a.linkblack:visited { text-decoration:none; color:black}
a.linkblack:hover { text-decoration: underline; color:black}
input { font-family: "宋体"; font-size: 9pt}
td { font-family: "宋体"; font-size: 9pt; color: #000000}
.en { font-family:"Verdana", "Arial"; font-size: 9pt}
.white { color: #FFFFFF}
.line { line-height: 20px}
.title { font-size: 14px }
-->
</style>
</head>
<body>
<form name="Login" method="post" action="check.asp" align="center" onSubmit="return Check()">
<div ><table border="1" width="36%" bgColor="#ffe4b5" style="HEIGHT: 237px; WIDTH: 306px" bordercolor="#0000ff">
<tr>
<td width="100%" align="middle" bgcolor="#ffffff" bordercolor="#808080">
<strong><font face="黑体" color="#008080" size="5">通用登录系统</font></strong></td>
</tr>
<tr>
<td width="100%" align="middle" bgcolor="#ccffff">
<p style="BACKGROUND-COLOR: antiquewhite" align="center"><font color="#800080">
<font size="2">请输入用户名:</font><BR></font><input name="UID" maxlength="10" > <br><font color="#800080">请输入密码:<br></font><input type="password" name="PWD" maxlength="10" ><BR><BR></p><p align="center"><input type="submit" value="提交" name="submit"> <input type="reset" value="清除" name="Reset"></p>
<p align="center"><font face="楷体_GB2312">
<a href="../../chap9/explain.htm">会员注册</a></font></font></p></td></tr>
<center>
</table>
</div>
</form>
</body>
</html>。
常用ASP代码大全
常用ASP代码大全1.获得系统时间:<%=now()%>2. 取得来访用的IP:<%=request.serverVariables("remote_host")%>3.获得系统,浏览器版本:<script>window.document.write(" 版本:"+navigator.appName+navigator.appVersion+" browser.")</script>4.去除IE混动条:<body scroll="no"><body style="overflow-y:hidden">5.进入网站,跳出广告:<script language="javascript"><!--<!-- 注意更改文件所在路径-->window.open(''",'''',''height=200,width=300,top=0,left=30'');// --></script>6.随机数:<%randomize%><%=(int(rnd()*n)+1)%>N 为可改变数7.向上混动代码:<marquee direction="up" scrolldelay="200" style="font-size: 9pt; color: #FF0000;line-height: 150%; font-style:italic; font-weight:bold" scrollamount="2" width="206"height="207" bgcolor="#FFFF00">Unix中文站</marquee>8.自动关闭网页:<script LANGUAGE="javascript"><!--setTimeout(''window.close();'', 10000); //60秒后关闭// --> </script><p align="center">本页10秒后自动关闭,请注意刷新页面</p>9.随机背景音乐:<%randomize%><bgsoundsrc="/qz.q/mids/<%=(int(rnd()*60)+1)%>.mid"loop="-1"> 可以修改数字,限制调用个数,我这里是60个.10.自动刷新本页面:<script><!--var limit="0:10"if (document.images){var parselimit=limit.split(":")parselimit=parselimit[0]*60+parselimit[1]*1 }function beginrefresh(){if (!document.images)returnif (parselimit==1)window.location.reload()else{parselimit-=1curmin=Math.floor(parselimit/60)cursec=parselimit%60if (curmin!=0)curtime=curmin+"分"+cursec+"秒后重刷本页!"elsecurtime=cursec+" 秒后重刷本页!"window.status=curtimesetTimeout("beginrefresh()",1000) } }window.onload=beginrefreshfile://--></script>11.ACCESS数据库连接:<%option explicitdim startime,endtime,conn,connstr,dbstartime=timer()'更改数据库名字db="data/dvBBS5.mdb"Set conn = Server.CreateObject("ADODB.Connection")connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)'如果你的服务器采用较老版本Access驱动,请用下面连接方法'connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(db)conn.Open connstrfunction CloseDatabaseConn.closeSet conn = NothingEnd Function %>12.SQL数据库连接:<%option explicitdim startime,endtime,conn,connstr,dbstartime=timer()connstr="driver={SQLServer};server=HUDENQ-N11T33NB;uid=sa;pwd=xsfeihu;database=dvbbs"Set conn = Server.CreateObject("ADODB.Connection")conn.Open connstrfunction CloseDatabaseConn.closeSet conn = NothingEnd Function%>13.用键盘打开网页代码:<script language="javascript">function ctlent(eventobject){ if((event.ctrlKey && window.event.keyCode==13)(event.altKey && window.event.keyCode==83)){ window.open('网址','','') } }</script>这里是Ctrl+Enter和Alt+S的代码自己查下键盘的ASCII码再换就行14.让层不被控件复盖代码:<div z-Index:2><object ***></object></div> #前面<div z-Index:1><object ***></object></div> #后面<div style="position:absolute; top:40;width:400px; height:95px;z-index:2"><table height=100% width=100% bgcolor="#ff0000"><tr><td height=100% width=100%></td></tr></table><iframe width=0 height=0></iframe></div><div style="position:absolute; top:50;width:200px; height:115px;z-index:1"><iframe height=100% width=100%></iframe></div>。
asp注册登陆系统源代码
<tr>
<td height="30">Mail:</td>
<td height="30"><input name="mail" type="text" id="mail" value="<%=mail%>"></td>
</tr>
<tr>
<td height="30">地 址:</td>
set rsc=nothing
if nr="" then
response.Redirect("index.aspcomp(nr,request.Form("password"))=0 then
response.Write("欢迎你!"&request.Form("username"))
*</td>
</tr>
<tr>
<td height="30">密 码:</td>
<td height="30"><input name="password" type="text" id="password" value="<%=password%>">
*</td>
电子商务源代码
<tr>
<td bgcolor="#FFFFFF"><strong>新密码</strong></td>
<td bgcolor="#FFFFFF"><input type="text" value="" name="npwd"></td>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="admincheck.asp"-->
<!--#include file="conn.asp"-->
<%
if request.QueryString("act")="edit" then
'check password
sqlCP="select id from [admin] where [password]='"&md5(trim(request.Form("opwd")))&"'"
set rsCP=server.CreateObject("adodb.recordset")
</tr>
<tr>
<td colspan="2" bgcolor="#FFFFFF"><input type="submit" value="修改"></td>
php用户登录页面代码源代码
//登入页面$conn=mysql_connect('127.0.0.1','root','')or die("连接失败");mysql_select_db('tujian',$conn)or die("未找到该数据库");define(ALL_PS,"vivid"); mysql_query("set names GBK");if($_POST[submit]){$postcode=strtolower($_POST["code"]);$postcode=strtoupper($_POST["code"]);$uid=str_replace(" ","",$_POST[uid]);$sql="select * from users where `uid`='$_POST[uid]'";$query=mysql_query($sql);$user=is_array($row=mysql_fetch_array($query));$mi=$user?md5($_POST[pass].ALL_PS)==$row[pass]:FALSE;if($mi){$_SESSION[uid]=$row[uid];$_SESSION[name]=$row[name];$_SESSION[id]=$row[id];$_SESSION[user_shell]=md5($row[uid].$row[pass].ALL_PS);if( $_SESSION["code"]==$postcode){echo"<script>alert('登录成功!');location.href='index.php';</script>";}else{echo"<div class='show'>验证码输入错误,请重新输入!</div>";}}else{echo"<div class='show'>用户名或密码输入错误</div>";session_destroy();}}><SCRIPT language=javascript>function Checklogin(){if(myform.uid.value=="账号/学号"){alert("请填写登录名");myform.uid.focus();return false;}if(myform.pass.value=="密码/身份证后六位数"){alert("密码不能为空");myform.pass.focus();return false;if(myform.code.value=="验证码"){alert("请填写验证码");myform.code.focus();return false;}}</SCRIPT><style type="text/css"><!--body {background-image: url(images/user_loginbg.jpg); }--></style><style type="text/css"><!--.STYLE1 {color: #000000;font-size: 18px;}body {background-color: #f7f4f6;}.position{position: absolute;top: 10pxright: 200pxwidth: 296px;left: 878px;top: 161px;height: 304px;width: 258px;}.position2{position: absolute;left:63px;top:250px;}.position3{position:absolute;left: 935px;top: 122px;font-size:25px;font-family: Arial, Helvetica, sans-serif;}.STYLE8 {position: absolute;font-size: 30px;font-family: Arial, Helvetica, sans-serif;color: #0000FF;top: 0px;left: 40px;}.STYLE9 {font-size: 18px;font-family: "宋体";}.STYLE10 {font-family: "Courier New", Courier, monospace;font-weight: bold;}.STYLE11 {color: #FFFFFF;font-weight: bold;text-decoration:none;}.show{position:absolute;left:1135px;top:400px;}--></style><html><title>用户登录</title><body background="images/login.PN"><form action="" method="post" name="myform" onsubmit="return Checklogin();"><div class="position"><table width="296" height="250" align="right" bordercolor="#ffffff" bgcolor="#ffffff"><tr><td width="292" height="37" bgcolor="#ffffff"> <h1 class="STYLE1"> 欢迎登录</h1></td> </tr><tr><td><div align="center"><br> <input type="text" value="账号" onfocus="if(value=='账号') {value=''}" onblur="if (value=='') {value='账号'}" name="uid" style="width:180px;height:25px;color:#939597;"/><br></div></td></tr><tr><td> <div align="center"> <input type="text" value="密码" onfocus="if(value=='密码') {value=''}" onblur="if (value=='') {value='密码'}" name="pass" style="width:180px;height:25px;color:#939597;"/><br></div></td></tr><br><tr><td> <div align="center"> <input type="text" value="验证码" onfocus="if(value=='验证码') {value=''}" onblur="if (value==''){value='验证码'}" name="code" style="width:80px;height:25px;color:#939597;"/> <span style="color:#867e82;font-size:10pt;">填写下图所示文字</span><br /> <img src="code.php?" alt="点击刷新" onClick="this.src=this.src+'?'" /><span size="20px"style="color:#867e82;font-size:10pt;">看不清?点击图片刷新</span></p></div></td></tr><tr><td height="297"><div class="position2"> </div><span class="position2"><input type="submit" name="submit" style="background:#2c64f3; height:39px; width:110px; font-size: 24px; font-style: inherit; font-weight: normal;color:#fff" value="登入"/></span></td></tr></table></div><p class="STYLE8"> </p><p class="STYLE8"><span class="STYLE10">土建学院交流平台</span><span class="STYLE9"> 登录界面</span></p><p class="STYLE8"> </p><p class="STYLE8"> </p></form><p> </p><p> </p><p><div class="position3"><a href="register.php"class="STYLE11">立即注册</a></div></p></body></html>。
实现登录功能的代码
实现登录功能的代码以下是一个使用 Python 实现登录功能的简单示例代码:```python# 假设有一个用户表,包含用户 ID 和密码user_table = {'user1': 'pass1','user2': 'pass2',}# 登录功能实现def login(username, password):# 检查用户是否存在if username in user_table:# 检查密码是否匹配if user_table[username] == password:print(f"登录成功,用户 {username} 已登录。
") return Trueelse:print(f"密码错误,登录失败。
")return Falseelse:print(f"用户 {username} 不存在,登录失败。
")return False# 示例用法username = input("请输入用户名:")password = input("请输入密码:")if login(username, password):print("欢迎登录!")else:print("登录失败,请检查用户名和密码。
")```在这个示例中,我们使用一个字典 `user_table` 来模拟用户表,其中包含了用户 ID 和对应的密码。
`login()` 函数接受用户名和密码作为参数,检查用户是否存在并验证密码是否匹配。
请注意,这只是一个简单的示例代码,实际的登录功能可能需要考虑更多的因素,如数据库操作、密码加密、用户权限等。
根据你的具体需求,你可能需要使用数据库来存储和验证用户信息,以及使用更复杂的密码加密算法来保护用户密码的安全性。
PHP登陆页面完整代码
PHP登陆页⾯完整代码/*包括的⽂件*//*login.php*/<?phprequire('./mysql.php');$username=$_REQUEST['username'];$passwd=$_REQUEST['passwd']session_start();$_SESSION['s_username']=$username;$query_user="select * from user where username = '$username' and passwd = '$passwd'";$db=new mysql();//实例化类mysql$result = $db->query_exec($query_user);//验证⽤户$num_results=$result->num_rows;//取得数据库中的记录⾏if($num_results==0){echo 'login fail!!';><p><a href="./template/login.htm">返回登陆</a></p><?php}else{header("Location: ./index.php");}>/*templates/login.tpl*/<html><head><meta http-equiv="text/html;charset='utf-8'"><link rel="stylesheet" type="text/css" href="./css/login.css"><script type="text/javascript" src="js/face.js"></script></head><body><table width="400px" height="208" border="0" cellpadding="0" cellspacing="0" ><form id="login" name="login" method="post" action="a.php" onSubmit=""><tr><td height="25" align="right">⽤户名:</td><td><input name="name" type="text" onmouseover="this.style.backgroundColor='#ffffff'"onMouseOut="this.style.backgroundColor='#e8f4ff'" size="15" /></td></tr><tr><td height="25" align="right">密码:</td><td><input name="password" type="password" id="password" onmouseover="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#e8f4ff'" size="15" /></td></tr><tr><td height="25"align="right">验证码:</td><td><input name="check" type="text" id="check" onmouseover="this.style.backgroundColor='#ffffff'" onMouseOut="this.style.backgroundColor='#e8f4ff'" size="10" /><img src="code.php" id="code" /></td> </tr>/*mysql.php*/<?phpvar $db_host = 'localhost';var $db_username= 'root';var $db_password= '123';var $db_database= 'new';$db =mysql_connect($ db_host,$db_username,$-> db_password,$-> db_database);if (mysqli_connect_errno()) {echo "连接数据库失败!";exit;}return $db;}}>/*效果为*/分类:。
ASP网络应用程序设计教程(第二版)例题源代码
ASP_SE 各章示例代码
【例 1.1】简单静态 HTML 网页示例 <!-- File Name: 世界你好.htm --> <html> <head> <title> 简单静态网页示例 </title> </head> <body> <p align="center"><font color="blue">Hello World!</font></p> <p align="center"><font face="黑体">世界你好!</font></p> </body> </html>
src = "left.htm" >
totay = Date() theTime = Time() If left(theTime,2)> "12" Then
Response.Write "<H3>下午好!</H3>" Else
Response.Write "<H3>上午好!</H3>" End If %> 今天是 <%=totay%>,时间 <%=theTime%> </body> </html>
【例 1.2】客户端动态网页示例 <!-- File Name: hello.htm --> <html> <head> <script language="JavaScript"> function getname(str) {alert("您好! "+ str+"!");} </script> </head> <body> 请输入您的姓名: <form> <input type="text" name="name" onBlur="getname(this.value)" value=""> </form> </body> </html>
asp多种用户登陆代码
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><!--#include file="conn.asp" --><%dim uid ,upwd'获取并简单处理用户输入的信息uid=trim(Request.Form("txt_id"))upwd=trim(Request.Form("txt_pwd"))ushf=request("shf")'判断用户是否登录,否则提示登录if uid="" or upwd="" thenresponse.write "<script language=JavaScript>window.alert('账号和密码不能为空!');window.location.href='index.asp';</script>"response.endend if'定义一个记录集对象rsset rs=server.createobject("adodb.recordset")'根据登录身份设置不同的SQL字符串和身份标志变量,并引导到不同页面if ushf="admin" thengeturl="admin.asp"flag="admin"sqltext="select * from admin where admin_name='" & uid & "' and admin_pwd='" & upwd & "'"else if ushf="user" thengeturl="user.asp"flag="user"sqltext="select tc_id from infor where tc_name='" & uid & "' and tc_pwd='" & upwd & "'"end ifelse if ushf="pwd" thengeturl="user.asp"flag="user"sqltext="select in_id from infon where in_name='" & uid & "' and in_pwd='" & upwd & "'"end ifend if'利用上面定义的SQL字符串打开记录集rs.open sqltext,conn,1,1'判断记录集是否存在记录if rs.recordcount >= 1 then'根据不同身份,定义uid变量的值,该值为表中的主键字段if ushf="user" thenuid = rs("tc_id")elseif ushf="admin" thenuid = rs("admin_id")elseif ushf="pwd" thenuid = rs("in_id")End if'定义cookie对象分别保存用户输入的信息response.cookies("flag") = flagresponse.cookies("uid") = uidresponse.cookies("upwd") = upwd'跳转到相应的页面Response.Redirect geturl'关闭该记录集rs.closeelse'当用户名和密码不对时,给出提示信息,并返回首页要求重新登录response.write "<script language=JavaScript>window.alert('账号和密码错误!');window.location.href='index.asp';</script>"response.endrs.closeend if%><!--#include file="conn.asp"--><%dim type1'获取并简单处理用户输入的信息type1=request("type")username=request("username")password=request("password")if type1="1" then'定义一个记录集对象rsset rs=server.createobject("adodb.recordset")sql="select * from student where mm='"&password&"' and xh='"&username&"'"rs.open sql,conn,3,1'根据登录身份设置不同的SQL字符串和身份标志变量,并引导到不同页面if rs.recordcount<=0 thenresponse.redirect "login.asp"elsesession("type")=type1response.redirect "mainframe.asp"end ifelseif type1="2" thenset rs=server.createobject("adodb.recordset")sql="select * from qyxx where mm='"&password&"' and qyxh='"&username&"'"rs.open sql,conn,3,1if rs.recordcount<=0 thenresponse.redirect "login.asp"elsesession("type")=type1response.redirect "mainframe.asp"end ifelseset rs=server.createobject("adodb.recordset")sql="select * from admin where adminmm='"&password&"' and adminid='"&username&"'"rs.open sql,conn,3,1if rs.recordcount<=0 thenresponse.redirect "login.asp"elsesession("type")=type1response.redirect "mainframe.asp"end ifend if%>。
动态网页制作与编程aspaccess
技术选型:选 择ASP和Access 作为开发工具, 说明选择的理 由
系统设计:设 计系统的整体 架构和数据库 结构
系统实现:详 细介绍如何使 用ASP和Access 实现在线考试 系统
案例三:新闻发布系统的实现
新闻发布系统介绍
ASP技术实现动态网页
Access数据库设计
新闻发布系统功能模块
案例四:会员管理系统的实现
ASP可以与HTML、JavaScript等技术结合使用,提高网页的交互性和动态性
ASP的开发环境
服务器:安装IIS(Internet Information Services) 开发工具:Visual Studio、Dreamweaver等 数据库:Access、SQL Server等 语言:VBScript、JavaScript等
跨平台兼容性:ASP、Access将更好地支持跨平台应用,实现在不同操作系统和设 备上的无缝应用体验。
感谢观看
汇报人:XX
需求分析:介绍会员管理系统的功能需求和业务逻辑
数据库设计:设计会员管理系统的数据库结构,包括表、字段和关系
ASP编程:使用ASP技术实现会员管理系统的登录、注册、信息查询和修改等功能 的代码
Access数据库连接:使用Access数据库存储会员信息,并实现与ASP程序的连接 和数据交互
07
ASP、Access的发展趋势与展望
添加 标题
动态网页制作:ASP、Access可以用于构建交 互式的动态网页,实现数据的管理和展示。
添加 标题
数据库管理:Access作为小型数据库管理系统, 可以用于存储和管理数据,与ASP结合可以实 现数据的增删改查等操作。
添加 标题
办公自动化:ASP、Access可以用于构建企业 内部的办公自动化系统,实现流程管理、文档 共享等功能。
登陆界面代码
登陆界⾯代码1、设计思想添加窗⼝界⾯,想i⾯添加⼀系列组件。
输⼊账号密码和验证码后,如果验证码正确,进⾏注册,否则注册失败。
注册成功后,验证码⾃动刷新,并将注册的帐号和密码保存。
注册失败后,验证码刷新,从新注册。
⽽后进⾏登录,输⼊帐号密码和验证码,当三个都输⼊对的时候,登录成功,否则登录失败,刷新验证码重新登录。
当点击刷新验证码后,验证码⾃动刷新。
2、流程图3、源程序代码package java作业;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Random;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JTextField;class chuang extends JFrame implements ActionListener{private JTextField txt1;private JTextField txt2;private String base = "abcdefghijklmnopqrstuvwxyz0123456789";private String zifu;private JLabel haha;private JTextField txt3;private JButton d;private JButton dl;private JButton zc;private String zhanghao;private String mima;private String yanzheng;private StringBuffer sb;chuang(){setBounds(800,400,300,250);setVisible(true);setTitle("界⾯");setDefaultCloseOperation(EXIT_ON_CLOSE);setLayout(null);JLabel zh=new JLabel("帐号:");zh.setBounds(20,15,50,25);add(zh);JLabel mm=new JLabel("密码:");mm.setBounds(20,50,50,25);add(mm);JLabel en=new JLabel("点击按钮后,放⼤窗⼝刷新验证码");en.setBounds(20,150,200,25);add(en);Random random = new Random();sb = new StringBuffer();for (int i = 0; i < 4; i++){int number = random.nextInt(base.length());sb.append(base.charAt(number));}haha=new JLabel(sb.toString()+":");haha.setBounds(20,85,50,25);add(haha);txt1 = new JTextField(20);txt1.setBounds(65,15,150,25);add(txt1);txt1.setText("请输⼊帐号");txt2 = new JTextField(20);txt2.setBounds(65,50,150,25);add(txt2);txt2.setText("请输⼊密码");txt3 = new JTextField(20);txt3.setBounds(65,85,100,25);add(txt3);txt3.setText("请输⼊验证码");d=new JButton("刷新验证码");d.addActionListener(this);d.setBounds(170,85,100,24);add(d);dl=new JButton("登录");dl.addActionListener(this);dl.setBounds(35,120,75,24);add(dl);zc=new JButton("注册");zc.addActionListener(this);zc.setBounds(120,120,75,24);add(zc);validate();}public void actionPerformed(ActionEvent e){if(e.getSource()==d){remove(haha);Random random = new Random();sb = new StringBuffer();for (int i = 0; i < 4; i++){int number = random.nextInt(base.length());sb.append(base.charAt(number));}haha=new JLabel(sb.toString()+":");haha.setBounds(20,85,50,25);add(haha);validate();}else if(e.getSource()==dl){yanzheng=txt3.getText();if(yanzheng.equals(sb.toString())&&txt1.getText().equals(zhanghao)&&txt2.getText().equals(mima)) {JFrame ha=new JFrame("登录界⾯");ha.setBounds(880,460,150,100);ha.setVisible(true);JLabel hao=new JLabel("登录成功!");ha.add(hao);validate();}else{JFrame ha=new JFrame("登录界⾯"); ha.setBounds(880,460,150,100);ha.setVisible(true);JLabel hao=new JLabel("登录失败!"); ha.add(hao);validate();}}else if(e.getSource()==zc){yanzheng=txt3.getText();zhanghao=txt1.getText();mima=txt2.getText();if(yanzheng.equals(sb.toString())){JFrame ha=new JFrame("注册界⾯"); ha.setBounds(880,460,150,100);ha.setVisible(true);JLabel hao=new JLabel("注册成功!"); ha.add(hao);validate();}else{JFrame ha=new JFrame("注册界⾯"); ha.setBounds(880,460,150,100);ha.setVisible(true);JLabel hao=new JLabel("注册失败!"); ha.add(hao);validate();}remove(haha);Random random = new Random();sb = new StringBuffer();for (int i = 0; i < 4; i++){int number = random.nextInt(base.length()); sb.append(base.charAt(number));}haha=new JLabel(sb.toString()+":"); haha.setBounds(20,85,50,25);add(haha);validate();}}public void shuzi(){Random random = new Random(); StringBuffer sb = new StringBuffer();for (int i = 0; i < 4; i++){int number = random.nextInt(base.length()); sb.append(base.charAt(number));}System.out.println(sb.toString());}}public class suiji {public static void main(String args[]){new chuang();}}4、结果截图。
