Response.Write("<script language='javascript'>alert('hello!')</script>");

解决方案 »

  1.   

    Javascript有许多内建的方法来产生对话框,如:window.alert(), window.confirm(),window.prompt().等。 然而IE提供更多的方法支持对话框。如:showModalDialog() (IE 4+ 支持)
        
        test1.htm
    ====================
       <script>
    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)
       </script>    test2.htm
    ====================
        <script>
    var a = window.dialogArguments
    alert("您传递的参数为:" + a)
       </script>   test3.htm
    ====================
       <script>
    var a = window.dialogArguments
    alert("您传递的参数为window对象,名称:" + a.name)
       </script>   可以通过window.returnValue向打开对话框的窗口返回信息,当然也可以是对象。例如:    test4.htm
    ===================
        <script>
    var a = window.showModalDialog("test5.htm")
    for(i=0;i<a.length;i++) alert(a[i])
        </script>    test5.htm
    ===================
        <script>
           function sendTo()
           {
    var a=new Array("a","b")
    window.returnValue = a
    window.close()
            }
        </script>
        <body>
    <form>
    <input value="返回" type=button onclick="sendTo()">
    </form> 常见问题:
    1,如何在模态对话框中进行提交而不新开窗口?
    如果你 的 浏览器是IE5.5+,可以在对话框中使用带name属性的iframe,提交时可以制定target为该iframe的name。对于IE4+,你可以用高度为0的frame来作:例子, test6.htm
    ===================
    <script>
    window.showModalDialog("test7.htm")
    </script> test7.htm
    ===================
    if(window.location.search) alert(window.location.search)
    <frameset rows="0,*">
    <frame src="about:blank">
    <frame src="test8.htm">
    </frameset> test8.htm
    ===================
    <form target="_self" method="get">
    <input name=txt value="test">
    <input type=submit>
    </form>
    <script>
    if(window.location.search) alert(window.location.search)
    </script>
    2,可以通过http://servername/virtualdirname/test.htm?name=mxh方式直接向对话框传递参数吗?
    答案是不能。但在frame里是可以的。
      

  2.   

    使用我的WebMessageBox控件,下载地址:
    http://www.aspxcontrol.com
      

  3.   

    if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
    {
    e.Item.Cells[7].Attributes["onclick"]="return confirm('确认这条记录删除?');";
    }
      

  4.   


    if(MessageBox.Show( 要显示的话,"标题",MessageBoxButtons.YesNo,MessageBoxIcon.Information,MessageBoxDefaultButton.Button1,MessageBoxOptions.ServiceNotification )==DialogResult.Yes)
    {
    //确认处理后要执行的代码
    }
      

  5.   

    记得引用:
    using System.Windows.Forms;
      

  6.   

    ubc(做程序员“挺”好!) 
    在asp.net中能添加system.windows.forms这个命名空间吗?
      

  7.   

    解决方案(右边)有个引用,右击添加引用
    System.Windows.Forms.dll之后才可以使用
    using System.Windows.Forms;之后就可以按 ubc(做程序员“挺”好!) 说的那样使用MessageBox.Show啦 
      

  8.   

    JScript.Net同样与javascript一样的功能,还能实现如下:
    window.showModelDialog("yourhtm.htm","center=yes,toolbar=no,status=no")且可以:
    window.showModellessDialog(...同上)的功能,实现自定义对话框,
    具体请参阅微软的相关帮助。
      

  9.   

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

  10.   

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

  11.   

    Response.Write("<script language='javascript'>alert('hello!')</script>");