例如:
<script   type="text/javascript">
        function   getInternetExplorerVersion()
        {
              ....
              vr   =   ...
              return   vr;
        }
</script>
然后在
<?php   ?> 如何获取javascript中函数getInternetExplorerVersion的值,谢谢。

解决方案 »

  1.   

    ajax或者隐藏的iframe给个隐藏的iframe你看
    <iframe style='display:none' id='phpPage'></iframe>
    <script type="text/javascript"> 
    function getInternetExplorerVersion() 
    {
      document.getElementById('phpPage').src='xxxx.php?v="+vr;//
    }
    </script>
    xxxx.php,php代码不会,接受get方法提交的参数你自己写,参数名称为v
      

  2.   

    to showbo
    谢谢,但我本想使得javascript函数getInternetExplorerVersion()与PHP代码放在同一个HTML中,如何获取呢,你上面写的好象是 放在不同的HTML中。
      

  3.   

    必须经过后台,不管ajax或者隐藏的iframe
    不过后台是不行的,直接提交也可以
      

  4.   

    可以啊,你就直接把上面的代码放到php中就可以了然后在这个php开头先获取这个v参数,判断是否为空的.下面是个asp的例子,你看看test.asp
    <%
    dim v:v=request.querystring("v")&""'获取get的v参数,连一个空字符串防止v为null
    if v<>"" then'接收到了参数
      response.write "<script>alert('参数v="&v&"')</script>"
      response.end'停止输出
    end if
    %>
    <iframe style='display:none' id='phpPage'></iframe>
    <script type="text/javascript"> 
    window.onload=getInternetExplorerVersion;//页面加载完后执行
    function getInternetExplorerVersion() 
    {
      document.getElementById('phpPage').src='xxxx.php?v="+vr;//
    }
    </script>
      

  5.   

    用ajax比较好, 因为javascript是客户端执行的. PHP 是服务器端执行的.
      

  6.   

    to showbo:
    <%
    dim v:v=request.querystring("v")&""'获取get的v参数,连一个空字符串防止v为null
    if v<>"" then'接收到了参数
      response.write "<script>alert('参数v="&v&"')</script>"
      response.end'停止输出
    end if
    %>这段我看不太懂,是关于ASP的,你能否写些PHP代码,我只会些PHP。