求助,代码如下,模板文件Login.tpl中,
<script>
function create_code(){
document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000;
}
</script>一直报错:“Fatal error: Smarty error: [in Login.tpl line 93]: syntax error: unrecognized tag: document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000; (Smarty_Compiler.class.php, line 446) in I:\masterPHP\vtigercrm\Smarty\libs\Smarty.class.php on line 1095

求各位大神指导!!!

解决方案 »

  1.   

    getElementById 后面怎么还有 x_x ?
      

  2.   

    smarty 的 tpl 里面 要直接写 javascript 或 style 要用 literal 标签 包起来
    例:
    {literal}
    <script>
    function create_code(){
        document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000;
    }
    </script>
    {/literal}
    不知道你的 有没有
      

  3.   

    要用{literal}     {/literal} 引起来