.cs
public sting data1;
private string getInfo(string Msg)
{
   data1 = "the name";
}
.html<head>
    <title>ReCall</title><script language="javascript" type="text/javascript">
       
    function fu1()
{
} </script>
    
  </head>  <body><%

if 1<>2 then
//运行函数fu1()

                else
//获取data1的值
end if
%>  </body>
请问在
if 1<>2 then
//运行函数fu1()

                else
//显示data1的值
end if如何运行函数fu1()和获取data1的值???

解决方案 »

  1.   

    <%
        
            if 1<>2 then
            //运行函数fu1()    
        
                    else
            //获取data1的值        
            end if
        %>
    你的这段代码是服务器端的, 如果你的条件语句可以在前台处理, 那么"运行函数fu1()和获取data1的值"就简单啦你的 if 1<>2能不能在前台处理呢?
      

  2.   


    <head>
        <title>ReCall</title>
    <script language="javascript" type="text/javascript">       
        function fu1()
    {
    }        </script>            
      </head>  <body>
      <% =RunScripts %>
      </body>
    cs代码public sting data1;public string getInfo(string Msg)
    {
       data1 = "the name";
    }public string RunScripts
    {
        get
        {
          if(1<>2) 
           return "<script>fu1</script>";
          else 
           return data1 ;
        }
    }