execScript Method 
--------------------------------------------------------------------------------Executes the specified script in the provided language.SyntaxvReturn = window.execScript(sExpression, sLanguage)
ParameterssExpression Required. String that specifies the code to be executed. 
sLanguage Required. String that specifies the language in which the code is executed. The language defaults to Microsoft® JScript®. Return ValueThis method always returns null.ResScript executed through the execScript method can access all global variables available to the calling script. This can be useful when you want the functionality of another scripting language that would not otherwise be available in JScript, such as the Microsoft Visual Basic® Scripting Edition (VBScript) MsgBox function.Standards InformationThere is no public standard that applies to this method. 

解决方案 »

  1.   

    var script=document.createElement("script")
    script.language="javascript"
    script.type = "text/javascript";
    script.src="a.js";
    document.body.appendChild(script);
      

  2.   

    to hansonboy
    是由一个php生成的,但效果和.js文件差不多吧
      

  3.   

    /*
    如题,另一段代码和调用的这段代码不在同一个文件中。
    如:
    <script language="javascript">
    function doit()
    {
    载入并运行xxxx文件(此文件内容也是javascript代码)
    setTimeout("doit()",5000);
    }
    doit();
    </script>
    **/1:为什么要这么做,你可以直接把文件在,引用之前包含进来,比方:
    <script type="text/javascript" src="youJS.js">
    <script language="javascript">
    function doit()
    {
    载入并运行xxxx文件(此文件内容也是javascript代码)
    setTimeout("doit()",5000);
    }
    doit();
    </script>2:如果一定要这样做,也可以结合服务端脚本语言来做--直接输出即可,比方:
    <script language="javascript">
    function doit()
    {
    <?php echo "载入并运行xxxx文件(此文件内容也是javascript代码)";?>
    //载入并运行xxxx文件(此文件内容也是javascript代码)
    setTimeout("doit()",5000);
    }
    doit();
    </script>
      

  4.   

    那就得用到所谓无刷技术了,使用xmlhttp
      

  5.   

    /**
    to hansonboy
    是由一个php生成的,但效果和.js文件差不多吧
    */<script language="javascript">
    function doit()
    {
    <?php echo "alert('Hello world!');";?>
    //载入并运行xxxx文件(此文件内容也是javascript代码)
    setTimeout("doit()",5000);
    }
    doit();
    </script>
      

  6.   

    function doit()
    {
    var xh = new ActiveXObject("Microsoft.XMLHTTP");
             xh.open( "url", false );
             xh.send();
             if( xh.status == 200 )
             {
               eval( xh.responseText);
             }
    setTimeout("doit()",5000);
    }
    doit();//即兴写的,你自己调一下。
      

  7.   

    哈哈,myvicy 热心肠的人的代码可以,并且在firefox中也正常,谢了
      

  8.   

    由于代码要跨域,所以不能用AJAX