我在这里调用一个JavaScript函数hideanddisplay()
来隐藏和显示使用<tiles:insert>
添加的菜单...
使用该函数的代码:
<td onclick="hideanddisplay()" class="productLogo" title="Click to Hide/Display Navigator">
<span style="cursor:pointer">hiii <span style="color:#FFFFFF">gud morning</span></span>
</td>
通过调用此函数,应根据要求隐藏和显示下面的代码...
<td id="sohamMenu" valign="top" class="leftmenuBG">
<div id="soham" class="TA" style="width:210px; height:500px; overflow-x:scroll; overflow-y:scroll;">
<tiles:insert attribute="menupage" />
</div>
</td>
这是隐藏和显示的功能:
function hideanddisplay() {
var cookiewval = getMyCookie("status");
if (cookiewval == "hide") {
$("#sohamMenu").show(500);
document.cookie = "status=show;";
} else {
$("#sohamMenu").hide(500);
document.cookie = "status=hide;";
}
function getMyCookie(name) {
var prefix = name + "=";
var start = document.cookie.indexOf(prefix)
if (start == -1) {
return null;
}
var end = document.cookie.indexOf(";", start + prefix.length)
if (end == -1) {
end = document.cookie.length;
}
var tempString = document.cookie
var value = tempString.substring(start + prefix.length, end)
return unescape(value);
}
答案 0 :(得分:1)
我得到了答案!!!! yoohooo ... !!! Show()和hide()对我不起作用..我试过fadeIn()fadeOut()... bingo !!!
$("#sohamMenu").fadeIn(500);
$("#sohamMenu").fadeOut(500);