怎样在后台代码获取其返回的值?

解决方案 »

  1.   

    ClientScript.RegisterStartupScript(this.GetType(), "message", " <script language='javascript' >if(Confirm('确认码?'))document.getElementById('Hf').value='1'; else document.getElementById('Hf').value='0'; </script>");  if(Hf.Value.Equals("1"))  
    {  } 
      

  2.   


    是先弹出框呢?
    还是执行完
    if(hf.Value.Equals("1"))
    {}
    再弹出提示框?
      

  3.   

    只能用ajax实现function GetXmlHttpObject() 
    {
        //创建XMLHttpRequest对象来发送和接收HTTP请求与响应
        xmlHttpObj = null;
        try 
        {
            // FireFox Opera 8.0+ Safari
            xmlHttpObj = new XMLHttpRequest();
            if(xmlHttpObj.overrideMimeType) 
            {
                xmlHttpObj.overrideMimeType('text/xml');
            }
        } 
        catch(e) 
        {
            // IE
            try 
            {
                xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch(e) 
            {
                xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
        return xmlHttpObj;
    }function StateChanged() 
    {
        if(___xmlHttp.readyState == 4) 
        { 
            if(___xmlHttp.status == 200) 
            {
            } 
            else 
            {
            }
        }
    }var ___xmlHttp=null;
    function SetConfig(result) 
    {
        if(___xmlHttp==null)
            ___xmlHttp = GetXmlHttpObject();
        if(___xmlHttp == null) 
            return false;
            
        var url = "?___command=SetConfig&___param="+result+"&___clientRandom=" + Math.random();    ___xmlHttp.open("GET", url, true);
        ___xmlHttp.onreadystatechange = StateChanged;
        ___xmlHttp.send(null);
        
    }<inpub type="button" value="abc" onclick="if(confirm('确定'))SetConfig('true') else SetConfig('false');" />
    后台代码:
    if (Request.QueryString["___command"] == "SetConfig")
    {
        if(Request.QueryString["___param"].ToLower() == "true")
        //确定时的代码
        else
       // 取消时的代码
    }