【发布时间】:2014-03-01 05:12:54
【问题描述】:
<script type="text/javascript">
var button = document.getElementById("button");
var idTab5 = document.getElementById("idTab5");
var button2 = document.getElementById("button2");
function showwMore() {
button.style.display="none";
idTab5.style="overflow:hidden;display:block;height:100%;font-size:12px;line-height:14px;";
button2.style.display="block";
}
function showwLess() {
button2.style.display="none";
idTab5.style="overflow:hidden;height:250px;font-size:12px;line-height:14px;";
button.style.display="block";
}
</script>
这是另一个代码:
{if $product->description|count_characters:true > 350 }
{* full description *}
<div id="idTab5" style="overflow:hidden;height:250px;font-size:12px;line-height:14px;">{$product->description}</div>
<input id="button" type="button" style="margin-top:5px;font-size:12px;color:white; width:120px;background:#4e3248;border:none;height:30px;border-radius:5px;" value="Mostrar +" onclick="showwMore()">
<input id="button2" type="button" style="margin-top:5px;display:none;font-size:12px;color:white; width:120px;background:#4e3248;border:none;height:30px;border-radius:5px;" value="Mostrar -" onclick="showwLess()">
{else}
<div id="idTab5" style="overflow:hidden;height:250px;font-size:12px;line-height:14px;">{$product->description}</div>
{/if}
现在对我来说似乎很好,但是 onclick,div 没有增长,知道为什么会这样吗?我检查了很多次代码都找不到它为什么不起作用,我错过了什么吗???
【问题讨论】:
标签: javascript php html css