html中能自动弹出对话框吗,html能弹出消息框吗?

ASP.NET中能弹出消息框吗?

就是在应用程序中使用MessageBox等弹出来的消息框!

不知道可以做到不,可以的话,该如何实现?

______________________________________________________________________________________________

答1:

Response.Write("");

______________________________________________________________________________________________

答2:

Javascript有许多内建的方法来产生对话框,如:window.alert(), window.confirm(),window.prompt().等。 然而IE提供更多的方法支持对话框。如:showModalDialog() (IE 4+ 支持)

test1.htm

====================

var mxh1 = new Array("mxh","net_lover","孟子E章")

var mxh2 = window.open("about:blank","window_mxh")

// 向对话框传递数组

window.showModalDialog("test2.htm",mxh1)

// 向对话框传递window对象

window.showModalDialog("test3.htm",mxh2)

test2.htm

====================

var a = window.dialogArguments

alert("您传递的参数为:" + a)

test3.htm

====================

var a = window.dialogArguments

alert("您传递的参数为window对象,名称:" + a.name)

可以通过window.returnValue向打开对话框的窗口返回信息,当然也可以是对象。例如:

test4.htm

===================

var a = window.showModalDialog("test5.htm")

for(i=0;i

test5.htm

===================

function sendTo()

{

var a=new Array("a","b")

window.returnValue = a

window.close()

}

常见问题:

1,如何在模态对话框中进行提交而不新开窗口?

如果你 的 浏览器是IE5.5+,可以在对话框中使用带name属性的iframe,提交时可以制定target为该iframe的name。对于IE4+,你可以用高度为0的frame来作:例子,

test6.htm

===================

window.showModalDialog("test7.htm")

test7.htm

===================

if(window.location.search) alert(window.location.search)

test8.htm

===================

if(window.location.search) alert(window.location.search)

2,可以通过http://servername/virtualdirname/test.htm?name=mxh方式直接向对话框传递参数吗?

答案是不能。但在frame里是可以的。

______________________________________________________________________________________________

答3:

使用我的WebMessageBox控件,下载地址:

http://www.aspxcontrol.com

______________________________________________________________________________________________

答4:

if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))

{

e.Item.Cells[7].Attributes["onclick"]="return confirm(‘确认这条记录删除?‘);";

}

______________________________________________________________________________________________

答5:

if(MessageBox.Show( 要显示的话,"标题",MessageBoxButtons.YesNo,MessageBoxIcon.Information,MessageBoxDefaultButton.Button1,MessageBoxOptions.ServiceNotification )==DialogResult.Yes)

{

//确认处理后要执行的代码

}

______________________________________________________________________________________________

答6:

记得引用:

using System.Windows.Forms;

______________________________________________________________________________________________

答7:

ubc(做程序员“挺”好!)

在asp.net中能添加system.windows.forms这个命名空间吗?

______________________________________________________________________________________________

答8:

解决方案(右边)有个引用,右击添加引用

System.Windows.Forms.dll

之后才可以使用

using System.Windows.Forms;

之后就可以按 ubc(做程序员“挺”好!) 说的那样使用MessageBox.Show啦

______________________________________________________________________________________________

答9:

JScript.Net同样与javascript一样的功能,还能实现如下:

window.showModelDialog("yourhtm.htm","center=yes,toolbar=no,status=no")且可以:

window.showModellessDialog(...同上)的功能,实现自定义对话框,

具体请参阅微软的相关帮助。

______________________________________________________________________________________________

答10:

http://lucky_elove.www1.dotnetplayground.com/

______________________________________________________________________________________________

答11:

http://lucky_elove.www1.dotnetplayground.com/ShowList.aspx?id=1

http://lucky_elove.www1.dotnetplayground.com/ShowDetail.aspx?id=9EEAFE96-3393-4228-A19C-C85A1456D104

______________________________________________________________________________________________

答12:

Response.Write("");

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值