当程序运行到代码
Response.Write("<script>alert(\"你选中的试题类型已经添加了,请重新选择!!!\")</script>");时,就会弹出一个框说“你选中的试题类型已经添加了,请重新选择!!!”,现在有这样一个问题: Label2.Text=score1.ToString(),Label2里存放分数,我想让程序在运行到Response.Write("<script>alert(\"你选中的试题类型已经添加了,请重新选择!!!\")</script")时,弹出一个框,里面的内容是“你的得分是75”。如果要实现这样的要求,代码怎么写呀????

解决方案 »

  1.   

    string str="你的得分是"+Label2.Text;
    Response.Write("<script>alert('"+str+"')</script>");
      

  2.   

    把javascript当客户端显示内容来写后台就可以了
      

  3.   

    转:关于模态窗口(showModalDialog)的专题讨论!
    1.模态窗口的打开
    2.模态窗口的关闭
    3.模态窗口的传递参数。
    4.其他。
    1.window.showModalDialog("DialogPage.aspx","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");2.window.close();3.传值
    ParentPage.aspx:
    window.showModalDialog("DialogPage.aspx?para1=aaa&para2=bbb");DialogPage.aspx:
    string str1=Request.QueryString["para1"].toString();
    string str2=Request.QueryString["para2"].toString();返回值
    DialogPage.aspx:
    window.returnValue="aaa";ParentPage.aspx:
    var str=window.showModalDialog("DialogPage.aspx");4.
    aspx页面在showmodeldialog情况下为什么一提交就重新打开一个页面?
    showmodaldialog打开的页面中在<head></head>之间加入一行:<base target="_self">