我想实现类似于新鲜事的功能,因此想把一部分消息隐藏起来。第一个div标签里面的id是唯一的,第一个子div中为默认显示的第一条,点击按钮就会展开所有的新鲜事。用tapestry写的
<t:block t:id="showGroupNotificationBlock">
<div id="${showGroupNotification.groupNotification.get(0).sourceId}">
<div style="dispaly:block;" id="oneNews">
<t:loop source="showGroupNotification.groupNotification.get(0)" value="showNotification" showNotification="showNotification" index="var:index">
<t:delegate to="chooseGroupBlock" />
${showNotification.id}
</t:loop>
<a class="label pull-right" href="javascript:displayShowUI(${showGroupNotification.groupNotification.get(0).sourceId})">show</a>
</div>
<div style="display:none" id="groupNews" >
<t:loop source="showGroupNotification.groupNotification" value="showNotification" showNotification="showNotification" index="var:index">
<t:delegate to="chooseGroupBlock" />
${showNotification.id}
</t:loop>
</div>
</div>
</t:block>后台的.js我是这么写的,但是根本没有效果啊...function displayShowUI(id)
{
var ui = jQuery("#"+id).find("div");
ui.find(".oneNews").hide();
ui.find(".groupNews").show();
}
本来直接用下面这一段代码是可行的,但是因为没有加上唯一的标签,所以只能搜索到的第一个div。function displayShowUI(id){
var ui = document.getElementById(oneNews);
ui.style.display = none;
var vi = document.getElementById(groupNews);
vi.style.display = block;
}
菜鸟一枚,求指导!!!
<t:block t:id="showGroupNotificationBlock">
<div id="${showGroupNotification.groupNotification.get(0).sourceId}">
<div style="dispaly:block;" id="oneNews">
<t:loop source="showGroupNotification.groupNotification.get(0)" value="showNotification" showNotification="showNotification" index="var:index">
<t:delegate to="chooseGroupBlock" />
${showNotification.id}
</t:loop>
<a class="label pull-right" href="javascript:displayShowUI(${showGroupNotification.groupNotification.get(0).sourceId})">show</a>
</div>
<div style="display:none" id="groupNews" >
<t:loop source="showGroupNotification.groupNotification" value="showNotification" showNotification="showNotification" index="var:index">
<t:delegate to="chooseGroupBlock" />
${showNotification.id}
</t:loop>
</div>
</div>
</t:block>后台的.js我是这么写的,但是根本没有效果啊...function displayShowUI(id)
{
var ui = jQuery("#"+id).find("div");
ui.find(".oneNews").hide();
ui.find(".groupNews").show();
}
本来直接用下面这一段代码是可行的,但是因为没有加上唯一的标签,所以只能搜索到的第一个div。function displayShowUI(id){
var ui = document.getElementById(oneNews);
ui.style.display = none;
var vi = document.getElementById(groupNews);
vi.style.display = block;
}
菜鸟一枚,求指导!!!
解决方案 »
- (100分悬赏)跪求jsp页面控件内文字方向设置问题解决方案
- 请教ExtJs4 GridPanel问题
- Opera不支持active。。。。在线急等
- 关于JQuery里的已经addClass的内容取值,标题要长!!
- Ext.tree.TreePanel问题
- 如何用javascript实现返回上一页的功能
- 怎么标红积分大于等于6,改行数据显示为红色
- 如何删除div内所有隐藏元素?jquery怎么写?
- blur在javascript函数中怎么使用,请给个例子???????????
- JS--iframe添加tabs问题,传参问题。
- 求助,2个js之间有冲突关于prototype
- 框架间JS函数调用求教
{
var ui = jQuery("#"+id).find("div");
ui.find("#"+oneNews).hide();
ui.find("#"+groupNews).show();
}
楼主,您看下这样修改后能不能实现您要的功能