什么?什么?什么?默认alert太丑了?不好看?
那你不会百度嘛?这不就来了?那没事了
先来看看对比(请忽略alert里面的文本)
一般我们alert就直接
Response.Write("<script>alert('信息')</script>");
直接上教程,先在工具箱添加一个panel,再在里面添加一个lable和button(我用的button不是asp的button)
把visible设置为false,默认不显示这个panel
<asp:Panel ID="result" runat="server" Visible="False">
<asp:Label ID="laadd" runat="server" Text="添加结果" ForeColor="White"></asp:Label>
<input type="button" value="(๑‾ ꇴ ‾๑)好哒" id="btnok" />
</asp:Panel>
样式啥的就自己写吧,具体你可以用绝对定位移动(移动这个panel)到屏幕中央,什么?你要样式(可能你也不要,不要也得要,哼~),设置样式的时候先不要隐藏,看看效果
ID和上面的不一样是因为用了母版,母版前缀是All_
#All_laadd{
display: inline-block;
width: 120px;
margin: 30px 0px;
font-size: 20px;
}
#All_result{
border-radius: 10px;
padding-bottom: 30px;
background-color: #237dcc;
position: absolute;
//移动的像素是按照自己的来,这只是我的
top: 100px;
left: 340px;
text-align: center;
width: 220px;
z-index: 200;
}
#btnok{
background-color: #3dcccc;
color: white;
border:none;
border-radius: 5px;
width:135px;
height: 40px;
border: 2px dashed #eee;
}
设置好样式之后
在页面后面的事件里面将visible设置为true
if (新增成功)
{
this.laadd.Text = "新增成功!";
this.result.Visible = true;
}
else
{
this.laadd.Text = "新增失败!";
this.result.Visible = true;
}
那么“提示框”就出来了,当你点击按钮(图中是(๑‾ ꇴ ‾๑)好哒)之后将visible改回成false,用单击事件在里面写
但是我图中用的不是asp的button,于是用Js,如下:
$("#btnok").click(function () {
//设置display样式为none
$("#All_result").css("display", "none")
})
想要那种显示几秒之后再消失?可以用定时器setInterval,设置好时间再display none就行 asp工具栏里的timer没整明白
碎碎念,我知道有更好看的提示框,还有其他方法,问题是,我没看懂,啊这……