下列这段JavaScript脚本在html里没问题,可放入tpl里后出错
<head>
  <SCRIPT>
    function toggle(e) {  //11行
      if (e.style.display == "none") {
btnSpan.innerText = "不表示";
e.style.display = "";
      } else {
btnSpan.innerText = "表示";
e.style.display = "none";
      }
    }
  </SCRIPT>
</head><span id="btnSpan" onclick="toggle(hideShow);">表示</span>
<div style="display:none;" id="hideShow">
  ...
</div>

解决方案 »

  1.   

    具体的错误是:
    Fatal error: Smarty error: [in kind_list.tpl line 11]: 
      syntax error: unidentified token '.style.display' (Smarty_Compiler.class.php, line 1410) 
      in D:\smarty\libs\Smarty.class.php on line 1093
      

  2.   

    带有{的是要处理的,要么改一下smarty的符号,要么用一个什么标志(忘了)查一下smarty手册就知道了。括起来就好了。
      

  3.   

    用{literal} {/literal} 标记
      

  4.   

    加{literal} {/literal} 解決了