易截截图软件、单文件、免安装、纯绿色、仅160KB

smarty里的JavaScript脚本出错了

下列这段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>
具体的错误是:
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


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


加{literal} {/literal} 解決了


相关问答:

趣味javascript... - Web 开发 / JavaScript

我也来一个趣味javascript:
打开以下html文件,依次按下G,L,C三个键,就会有奇迹出现!!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" ......

在VC里调用javascript - VC/MFC / 基础类

void CWEHelperDlg::OnOK(){
CString code;

//调用VBSCRIPT,能弹出消息框,也能正确返回 hello
code = "function main()\r\n\tMsgBox \"ok\"\r\n\tmain=\"hello\"\r\nend functio ......

IE里的javascript双击事件问题

javascript在IE里连续点击鼠标2次发生的事件顺序是:
mousedown --> mouseup --> click --> mouseup --> dblclick
我想将连续点击鼠标2次发生的事件顺序改为(即彻底屏蔽双击事件):
mousedown --&g ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号