html中的[%if %] [%/if%]是什么?

[%if $menutype == 'loglist' || $menutype == 'templatelist'%]
<ul class="listbottonul" id="listbottonul">
<li class="menumain"><a id="refresh" href="#body" onclick="javascript:refresh('selectform','selectall','check_all');" title="[%$ST.refresh_botton%]" hidefocus="true">[%$ST.refresh_botton%]</a></li>
</ul>
[%/if%]

这是针对此问题的测试页面,下面详细解释。

1、给第三个按钮绑定一个事件, onclick="fun()" 意思是点击时执行fun这个函数。

<input type="text" name="001" id="001" value="文本框1" />

<br>

<br>

<input type="text" name="002" id="002" value="文本框2" />

<br>

<br>

<input type="button" name="003" id="003" value="按钮" onclick="fun()" />

2、在javascript中声明fun函数。其中有个关键的地方是用document.getElementById('001').value这种写法获得id为"001"的文本框的值,同时可以用document.getElementById('002').value = 1;这种写法对id为"002"的文本框赋值。

function fun() {

if (document.getElementById('001').value == 'ok') {

document.getElementById('002').value = 1;

} else {

document.getElementById('002').value = 2;

}

}

3、这是运行效果

温馨提示:内容为网友见解,仅供参考
第1个回答  2014-09-03
这个是程序的代码段,不是布局写的代码,网站的程序代码哦
[%if %]就是执行判断本回答被网友采纳
第2个回答  2014-09-03
这是模板语言
相似回答