一个判断用户名是否被注册的随笔

[AjaxPro.AjaxMethod]
        
public  DataSet show2( string  sn)
        
{
            
string sql="select * from sheng where shengname like '%"+sn+"%' ";
            
return sqlwz.foundcn(sql,"sheng");
        }

        [AjaxPro.AjaxMethod]
        
public   string  checkuser( string  sn)
        
{
            WebApplication1.DB user
=new WebApplication1.DB();
            Boolean valid;
            
string sql = "Select * from users where UserName = '" + sn + "'";
            SqlDataReader reader 
=user.ReaderSql(sql);
            
if(reader.Read())
            
{
                valid
=false;
            }

            
else
            
{
                valid
=true;
            }

            reader.Close();
            user.close();
            
return valid.ToString();
        }
<% @ Register TagPrefix="ajax" Namespace="MagicAjax.UI.Controls" Assembly="MagicAjax"  %>
<% @ Page language="c#" Codebehind="aa.aspx.cs" AutoEventWireup="false" Inherits="ty.aa"  %>
<% @ Register TagPrefix="uc1" TagName="top" Src="top.ascx"  %>
<% @ Register TagPrefix="uc1" TagName="wzlist" Src="wzlist.ascx"  %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  >
< HTML >
    
< HEAD >
        
< title > aa </ title >
        
< meta  content ="Microsoft Visual Studio .NET 7.1"  name ="GENERATOR" >
        
< meta  content ="C#"  name ="CODE_LANGUAGE" >
        
< meta  content ="JavaScript"  name ="vs_defaultClientScript" >
        
< meta  content ="http://schemas.microsoft.com/intellisense/ie5"  name ="vs_targetSchema" >
        
< script  language ="javascript"  type ="text/javascript" >
         
function GetValue()
        
{
            
var shname=document.getElementById("input1").value;
            
var ds=ty.aa.show2(shname).value;
            
var lbl=document.getElementById("ss");
            
var temp="";
            temp
=temp+"<table width=300 heigth=300 border=1>";
            
for(var i=0;i<ds.Tables[0].Rows.length;i++)
            
{
                temp
=temp+"<tr>";
                temp
=temp+"<td>";
                temp
=temp+ds.Tables[0].Rows[i].shengName;
                temp
=temp+"</td>";
                temp
=temp+"<td>";
                temp
=temp+ds.Tables[0].Rows[i].MpNum;
                temp
=temp+"</td>";
                temp
=temp+"</tr>";
            }

            temp
=temp+"</table>";
            lbl.innerHTML
=temp;
        }

        
function check()
        
{
          
var username=document.getElementById("uname").value;
          
if(username=="")
          
{alert("null");return;}
          
var checked=ty.aa.checkuser(username).value;
          document.getElementById(
"result").style.display ='';
          
if(checked=="True")
          
{
            document.getElementById(
"result").innerHTML="恭喜您,可以注册!";
          }

          
else
          
{
            document.getElementById(
"result").innerHTML="此帐号已经被注册,请更换!";
            document.getElementById(
"uname").value="";
          }

        }

        
</ script >
    
</ HEAD >
    
< body  MS_POSITIONING ="GridLayout" >
        
< form  id ="Form1"  method ="post"  runat ="server" >
            
< TABLE  id ="Table1"  style ="Z-INDEX: 101; LEFT: 32px; WIDTH: 504px; POSITION: absolute; TOP: 88px; HEIGHT: 78px"
                cellSpacing
="1"  cellPadding ="1"  width ="504"  border ="1" >
                
< TR >
                    
< TD >< FONT  face ="宋体" ></ FONT ></ TD >
                    
< TD >< FONT  face ="宋体" ></ FONT ></ TD >
                    
< TD ></ TD >
                
</ TR >
                
< TR >
                    
< TD >< INPUT  id ="input1"  type ="text" >< INPUT  onclick ="GetValue()"  type ="button"  value ="加载" ></ TD >
                    
< TD >< INPUT  id ="uname"  type ="text"  onchange ="check()" >< div  id ="result"  onclick ="this.style.display ='none'"  style ="FONT-SIZE: 12px;Z-INDEX: 2007;CURSOR: hand;BACKGROUND-COLOR: #ffcc00" ></ div >
                    
</ TD >
                    
< TD >< FONT  face ="宋体" ></ FONT >< INPUT  onclick ="check()"  type ="button"  value ="检测" ></ TD >
                
</ TR >
                
< TR >
                    
< TD >< DIV  id ="ss"  ms_positioning ="FlowLayout" >< FONT  face ="宋体" ></ FONT ></ DIV >
                    
</ TD >
                    
< TD >< FONT  face ="宋体" >
                            
< asp:TextBox  id ="TextBox1"  runat ="server" ></ asp:TextBox ></ FONT ></ TD >
                    
< TD >< FONT  face ="宋体" >
                            
< asp:RequiredFieldValidator  id ="RequiredFieldValidator1"  runat ="server"  ErrorMessage ="RequiredFieldValidator"
                                ControlToValidate
="TextBox1" ></ asp:RequiredFieldValidator ></ FONT ></ TD >
                
</ TR >
            
</ TABLE >
            
&nbsp;&nbsp;&nbsp;
        
</ form >
    
</ body >
</ HTML >
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
很抱歉,作为一名 AI,我无法生成实际可用的网页代码。但是,你可以通过以下步骤自己创建一个简单的书城网页首页: 1. 编写 HTML 结构,包括头部、导航栏、轮播图、分类展示、推荐书籍等模块。 ``` <!DOCTYPE html> <html> <head> <title>书城首页</title> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> </head> <body> <header> <h1>书城</h1> <nav> <a href="#">首页</a> <a href="#">分类</a> <a href="#">购物车</a> <a href="#">我的</a> </nav> </header> <main> <div class="carousel"> <img src="carousel1.jpg" alt="轮播图1"> <img src="carousel2.jpg" alt="轮播图2"> <img src="carousel3.jpg" alt="轮播图3"> </div> <div class="categories"> <h2>分类</h2> <a href="#">小说</a> <a href="#">散文随笔</a> <a href="#">传记</a> <a href="#">哲学</a> <a href="#">历史</a> </div> <div class="recommendations"> <h2>推荐</h2> <div class="book"> <img src="book1.jpg" alt="书籍1"> <h3>书籍1</h3> <p>简介1</p> <p>价格1</p> </div> <div class="book"> <img src="book2.jpg" alt="书籍2"> <h3>书籍2</h3> <p>简介2</p> <p>价格2</p> </div> <div class="book"> <img src="book3.jpg" alt="书籍3"> <h3>书籍3</h3> <p>简介3</p> <p>价格3</p> </div> </div> </main> <footer> <p>© 2021 书城</p> </footer> </body> </html> ``` 2. 编写 CSS 样式,美化页面,使其更加吸引人。 ``` body { font-family: Arial, sans-serif; margin: 0; padding: 0; } header { background-color: #333; color: #fff; display: flex; justify-content: space-between; padding: 10px 20px; } nav { display: flex; } nav a { color: #fff; margin-left: 20px; text-decoration: none; } nav a:hover { text-decoration: underline; } main { padding: 20px; } .carousel { display: flex; justify-content: space-between; overflow: hidden; } .carousel img { width: 100%; } .categories { margin-top: 20px; } .categories h2 { font-size: 20px; } .categories a { display: block; margin-top: 10px; text-decoration: none; } .recommendations { margin-top: 20px; } .recommendations h2 { font-size: 20px; } .book { background-color: #eee; border-radius: 5px; display: inline-block; margin-right: 20px; padding: 10px; width: 200px; } .book img { width: 100%; } .book h3 { font-size: 16px; margin-top: 10px; } .book p { margin: 0; } footer { background-color: #333; color: #fff; padding: 10px 20px; text-align: center; } ``` 3. 在服务器上部署网页,使用户能够访问到。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值