⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guestbook.aspx

📁 ajax 三层软件开发实例,三层软件开发实例
💻 ASPX
字号:
<%@ Page Language="C#" MasterPageFile="~/UI/MasterPage.master" AutoEventWireup="true" CodeFile="guestbook.aspx.cs" Inherits="UI_guestbook" Title="Untitled Page"  Theme ="default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager id="ScriptManager1" runat="server" />

    <script language ="javascript" type ="text/javascript" >
        function val(value)
        {
                   var msg="";
                   var ok=true;
                   if( window.document .getElementById ('<%=txtCommend.ClientID %>').value=='')
                   {
                    msg='留言内容不能为空!\r\n';
                    ok=false;
                   }  
                   
                  
                 if( window.document .getElementById ('<%=txtName.ClientID %>').value.length>10)
                 {
                    msg +='网名长度不能大于10个字符!\r\n';
                    ok=false;
                 }
                 if( window.document .getElementById ('<%=txtEmail.ClientID %>').value.length>20)
                 {
                    msg +='信箱地址长度不能大于20个字符!\r\n';
                    ok=false;
                 }
                 if(window.document .getElementById ('<%=txtCommend.ClientID %>').value.length>500)
                 {
                    msg+='留言内容不能大于500个字符!\r\n';
                    ok=false;
                 }
              
                 if(window.document .getElementById ('<%=txtEmail.ClientID %>').value.length>0)
                 {
                     if(!isMail())
                     {
                        msg+='信箱格式不正确!\r\n';
                        ok=false;
                     } 
                 }
                 
                 if(!ok)
                 {
                    alert(msg);
                 }  
                 return ok;
        }
        
        
        function isMail()
        {
            return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(window.document .getElementById ('<%=txtEmail.ClientID %>').value);
        }
        
        function selectFace(Face)
        {
       
            var LastA;
	        LastA=document.getElementById (document.getElementById("bookface").value);//得到隐藏框中的值
	        LastA.className="LFace";//修改隐藏框中的样式为老样式
	        document.getElementById(Face).className="CFace";//修改选中图样式为新样式
	        LastA=document.getElementById(Face);//把选中图对像给隐藏框
	        document.getElementById(Face).blur();//选中图得到交点
	        document.forms[0].bookface.value=Face;//隐藏框记下当前选中的名字*/
	        
        }
           // function wz()
           // {
                
              //  var panel=window.document .getElementById ('<%=panOpenWindow.ClientID %>');
              //  panel.style .display='';
 
           // }
            
            
            function setBodyHeightToContentHeight() {
                document.body.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight)+"px";
            }
            
            function Mdown()
            {
               window.document .getElementById('<%=panHead.ClientID %>').style.filter="alpha(opacity=50)";
            }
            function Mup()
            {
               var obj=window.document .getElementById('<%=panHead.ClientID %>');
               obj.style.filter="alpha(opacity=100)";
            }
            setBodyHeightToContentHeight();
            window.attachEvent('onresize', setBodyHeightToContentHeight);

    </script>

    <asp:UpdatePanel id="UpdatePanel1" runat="server">
        <contenttemplate>
<DIV style="FLOAT: left; VERTICAL-ALIGN: middle; WIDTH: 200px; HEIGHT: 300px" id="myPhoto"><asp:Panel id="Panel1" runat="server" Height="300px" BorderColor="Silver" BorderWidth="1px" Font-Strikeout="False"><asp:Panel id="panOpenWindow" runat="server" Width="121px" Height="238px" __designer:wfdid="w2" CssClass="panel" Visible="False"><asp:Panel id="panHead" onmouseup="Mup();" onmousedown="Mdown();" runat="server" Width="137px" Height="235px" __designer:wfdid="w3" BackColor="Silver">点击拖动&nbsp;<BR /><asp:Panel id="panBody" runat="server" Width="196px" Height="213px" __designer:wfdid="w4" BackColor="White"><asp:TextBox id="TextBox1" runat="server" Width="189px" Height="240px" BorderColor="Gray" __designer:wfdid="w6" TextMode="MultiLine" BackColor="#E0E0E0" Rows="500" MaxLength="500"></asp:TextBox></asp:Panel> <asp:Button id="Button1" onclick="Button1_Click" runat="server" Width="58px" __designer:wfdid="w5" Text="Send" SkinID="btnSend"></asp:Button> </asp:Panel></asp:Panel> <asp:Label id="Label4" runat="server" Width="100%" Text="给我留言!">
        </asp:Label><BR />&nbsp;&nbsp; <asp:Label id="Label1" runat="server" Text="网名:"></asp:Label> <asp:TextBox id="txtName" runat="server" Width="131px"></asp:TextBox><BR />&nbsp;&nbsp; <asp:Label id="Label2" runat="server" Text="信箱:"></asp:Label> <asp:TextBox id="txtEmail" runat="server" Width="132px"></asp:TextBox><BR />&nbsp;&nbsp; <asp:Label id="Label3" runat="server" Text="留言内容:"></asp:Label>&nbsp;<BR />&nbsp;&nbsp; <asp:TextBox id="txtCommend" runat="server" Width="180px" Height="100px" BorderColor="Silver" BorderWidth="1px" TextMode="MultiLine"></asp:TextBox>&nbsp;<BR /><BR /><DIV style="BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; MARGIN-LEFT: 5px; BORDER-LEFT: silver 1px solid; WIDTH: 185px; BORDER-BOTTOM: silver 1px solid; HEIGHT: 15px"><A id="face1" class="LFace" onclick="selectFace('face1');" href="javascript:void(0)"><IMG style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; TEXT-DECORATION: none; BORDER-BOTTOM-STYLE: none" id="IMG1" height=35 alt="" src="../App_Themes/Default/images/1.gif" width=35 /></A><A id="face2" class="LFace" onclick="selectFace('face2');" href="javascript:void(0)"><IMG style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; TEXT-DECORATION: none; BORDER-BOTTOM-STYLE: none" height=35 alt="" src="../App_Themes/Default/images/2.gif" width=35 /></A><A id="face3" class="LFace" onclick="selectFace('face3');" href="javascript:void(0)"><IMG style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; TEXT-DECORATION: none; BORDER-BOTTOM-STYLE: none" height=35 src="../App_Themes/Default/images/3.gif" width=35 /></A><A id="face4" class="LFace" onclick="selectFace('face4');" href="javascript:void(0)"><IMG style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; TEXT-DECORATION: none; BORDER-BOTTOM-STYLE: none" height=35 src="../App_Themes/Default/images/4.gif" width=35 /></A><A id="face5" class="LFace" onclick="selectFace('face5');" href="javascript:void(0)"><IMG style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; TEXT-DECORATION: none; BORDER-BOTTOM-STYLE: none" height=35 src="../App_Themes/Default/images/5.gif" /></A> </DIV><BR /><asp:Button id="btnSend" onclick="btnSend_Click" runat="server" Width="60px" Text="Send" OnClientClick="return val('Send');" SkinID="btnSend"></asp:Button> <INPUT id="bookface" type=hidden value="face1" name="bookface" />&nbsp; <asp:UpdateProgress id="up" runat="server" __designer:wfdid="w1" DisplayAfter="300"><ProgressTemplate>
<img alt="" src="../App_Themes/Default/images/loading.gif" />正在加载......
</ProgressTemplate>
</asp:UpdateProgress> <ajaxToolkit:TextBoxWatermarkExtender id="TextBoxWatermarkExtender1" watermarkText="匿名" runat="server" TargetControlID="txtName">
        </ajaxToolkit:TextBoxWatermarkExtender> </asp:Panel> <BR /></DIV><DIV style="BORDER-RIGHT: silver 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: silver 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 0px; MARGIN-LEFT: 15px; BORDER-LEFT: silver 1px solid; WIDTH: 330px; PADDING-TOP: 2px; BORDER-BOTTOM: silver 1px solid; HEIGHT: 298px" id="info"><asp:panel id="Panel2" runat="server" Width="100%" Height="50px">&nbsp;<asp:LinkButton id="lbtnBack" onclick="lbtnBack_Click" runat="server" __designer:wfdid="w39">留言本</asp:LinkButton> <asp:Panel id="panPage" runat="server" Width="100%" Height="17px" __designer:wfdid="w2"><DIV style="WIDTH: 330px; HEIGHT: 260px" id="lyList"><asp:DataList id="dlLy" runat="server" UseAccessibleHeader="True"><ItemTemplate>
<DIV style="WIDTH: 100%; HEIGHT: 85px"><DIV style="BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; FLOAT: left; BORDER-LEFT: silver 1px solid; WIDTH: 60px; BORDER-BOTTOM: silver 1px solid; HEIGHT: 60px"><DIV style="MARGIN: 5px"><asp:Image id="lyPic" runat="server" __designer:wfdid="w6" height="50px" width="50px" imageUrl='<%#Eval("pic") %>'></asp:Image></DIV></DIV><DIV style="FLOAT: right; MARGIN-LEFT: 5px; OVERFLOW: hidden; WIDTH: 260px; WORD-BREAK: break-all; HEIGHT: 67px; WORD-WRAP: break-word"><asp:LinkButton id="lbtnContent" runat="server" 	style='<%#Eval("recontent").ToString().Length>0?"text-decoration: line-through;color :#786352;":"" %>' Text='<%# Eval("content") %>' __designer:wfdid="w7" CommandArgument='<%#Eval("id") %>' CommandName="lbtnContent" OnCommand="LinkButton1_Command"></asp:LinkButton></DIV><DIV style="FLOAT: left; WIDTH: 60px; HEIGHT: 12px; TEXT-ALIGN: center"><asp:Label id="lblName" runat="server" Text='<%# Eval("name") %>' __designer:wfdid="w8"></asp:Label></DIV>
<HR />
</DIV>
</ItemTemplate>
</asp:DataList> </DIV><asp:Label id="lblCurrent" runat="server" ForeColor="Red">1</asp:Label> <asp:Label id="lblTotalNum" runat="server"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:ImageButton id="ibtnPrev" onclick="ibtnPrev_Click" runat="server" SkinID="prev"></asp:ImageButton> <asp:ImageButton id="ibtnNext" onclick="ibtnNext_Click" runat="server" SkinID="next"></asp:ImageButton></asp:Panel> <asp:Panel id="PanManage" runat="server" Width="100%" Height="21px" __designer:wfdid="w3" Visible="False"><asp:Repeater id="Repeater1" runat="server" __designer:wfdid="w30">
 <ItemTemplate >
    <div style="WIDTH: 100%; HEIGHT: 250px"><div 
style="BORDER-RIGHT: silver 1px solid; BORDER-TOP: silver 1px solid; FLOAT: left; BORDER-LEFT: silver 1px solid; WIDTH: 60px; BORDER-BOTTOM: silver 1px solid; HEIGHT: 60px"><div 
style="MARGIN: 5px"><asp:Image id="lyPic" runat="server" imageUrl='<%#Eval("pic") %>' width="50px" height="50px"></asp:Image></div></div><div 
style="FLOAT: right; MARGIN-LEFT: 5px; WIDTH: 260px; HEIGHT: 250px; overflow: auto;"><asp:Label id="lblContent" runat="server" Text='<%# Eval("content") %>' Visible="False"></asp:Label> 
<asp:Label id="LinkButton1" runat="server" Text='<%# Eval("content") %>'></asp:Label><asp:Label id="lblrecontent" runat="server" Text='<%#Eval("recontent") %>'></asp:Label> </div><div 
style="FLOAT: left; WIDTH: 60px; HEIGHT: 12px"><asp:Label id="lblTimes" runat="server" Text='<%#Eval("time","{0:yyyy-MM-dd}") %>'></asp:Label></div>

</div>
 </ItemTemplate>
</asp:Repeater> <asp:Panel id="panDelAndReContent" runat="server" Width="100%" Height="2px" __designer:wfdid="w1"><asp:LinkButton id="lbtnDel" onclick="lbtnDel_Click" runat="server" OnClientClick="return confirm('你确认删除吗?');">删除</asp:LinkButton>&nbsp; <asp:LinkButton id="lbtnRecontent" onclick="lbtnRecontent_Click1" runat="server">回复</asp:LinkButton></asp:Panel></asp:Panel> </asp:panel> <ajaxToolkit:DragPanelExtender id="dpe" runat="server" DragHandleID="panHead" TargetControlID="panOpenWindow" __designer:wfdid="w5"></ajaxToolkit:DragPanelExtender></DIV>
</contenttemplate>
    </asp:UpdatePanel>
    &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</asp:Content>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -