文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>知识积累

知识积累

时间:2007-08-18  来源:linuxchao

图片按钮的应用: 1.图片按钮代替submit <input type=image  src="images/login.gif" alt="登陆" width="61" height="20" border="0"onclick="this.form.submit()"/> </td>
2.图片链接 <a href="register.jsp" target="_blank"><img src="images/register.gif" alt="注册" width="61" height="20" border="0" /></a></td> ------------------------------------------------------------------------   实时注册验证: 1.javascript部分      2.验证数据库部分(action):验证用户名是否已存在——用到了xml新技术    response.setContentType("text/xml;charset=UTF-8");      response.setHeader("Cache-Control", "no-cache");     String stuname = (String) request.getParameter("stuname");
  StudentDAO userDao=new StudentDAO();
  List list=(List)userDao.findByStuname(stuname);
  
  String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
  if (stuname.equals("") || stuname == null) {
   
   xml +="<message><info>用户名不能为空!</info></message>";
  }else if(!list.isEmpty())
  {
   xml += "<message><info>用户名已存在!</info></message>";
  }
  else
  {
   xml += "<message><info>用户名可用!</info></message>";
  }
  try {
   response.getWriter().write(xml);
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
3.web/jsp表层    <div class=Hint>用户名:</DIV>
  <div class=Input><INPUT id="stuname" tabIndex=1 size=24 name="stuname"onBlur="StunameCheck()"></DIV><div><span id="check_stuname"></span>
  </div>
浅红色代码部分为输出验证结果部分
     
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载