我想在网页上实现弹出一个输入框,输入信息之后按确定继续执行程序,跟winform的消息框功能一样,请问该怎么实现?

解决方案 »

  1.   

    javascript能弹出警告信息,输入框信息怎么实现呢?
      

  2.   


    InputBoxhttp://www.w3school.com.cn/vbscript/func_inputbox.asp或者div 模拟
      

  3.   

    window.prompt
    也可以用window.showModalDialog
      

  4.   

    在代码里面怎么写呢? 比如说是 response.write(<script></script>)
    还是用clientclick,或者是直接在click事件执行时弹出消息框接受消息,然后接着执行,不太熟悉webform,有没有好心人贴点代码演示一下?
      

  5.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="InputBox.aspx.cs" Inherits="InputBox" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        <script language="vbscript" type="text/vbscript"> 
        sub mysub()     dim fname
        fname=InputBox "Enter your name:"
        document.getElementById("<%=hid.ClientID %>").value=fname
        end sub
        </script>
        <script>
        function input()
        {
        
            document.getElementById("<%=hid.ClientID %>").value=prompt("Enter your name:");
        }    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:Button ID="btn" Text="vbscript弹输入框并回发" OnClientClick="javascript:document.getElementById('htmlBtn').click();" runat="server" OnClick="btn_Click" />
        <asp:Button ID="Button1" Text="javascript弹输入框并回发" OnClientClick="" runat="server" OnClick="btn_Click" />
        <input type="button" id='htmlBtn' onclick="mysub" style="width:0px" />    
        <asp:HiddenField ID='hid' runat="server" />
        </form>
    </body>
    </html>using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;public partial class InputBox : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {    }
        protected void btn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(hid.Value))
            {
                Response.Write(hid.Value + " 你好~");
            }
        }
    }
      

  6.   

    response.write("<script>window.prompt('請輸入')</script>")
      

  7.   

     function abc()
            {
                var sResult=prompt("what is your name","");
                if(sResult=="kang")
                  alert(sResult);
            }
      

  8.   

    response.write(" <script>window.prompt('輸入:') </script>")