【发布时间】:2015-02-14 02:38:23
【问题描述】:
需要明确的是,我有一个具有特定样式的 div,当我单击该 div 内的命令按钮时,我想将显示属性设置为“无”。
我希望通过单击命令按钮来更改 css 样式。
这是我的 xhtml :
<div class="details" id="detailsPopUp" style="#{detailsPopUpManager.style}">
<h:commandButton image="resources/images/close Icon.png"
action="#{detailsPopUpManager.closePopUp()}"
class="closeIcon"/>
</div>
这是 detailsPopUpManager 代码:
@Named(value = "detailsPopUpManager")
@SessionScoped
public class DetailsPopUpManager implements Serializable {
private String style;
public DetailsPopUpManager() {
style = "width:500px;\n" +
"height:500px;\n" +
"background: graytext;\n" +
"position: absolute;\n" +
"right: 25%;\n" +
"top: 10px;\n" +
"z-index: 1;";
}
public String getStyle() {
return style;
}
public void setStyle(String style) {
this.style = style;
}
public void closePopUp()
{
style = "width:500px;\n" +
"height:500px;\n" +
"background: graytext;\n" +
"position: absolute;\n" +
"right: 25%;\n" +
"top: 10px;\n" +
"z-index: 1;\n" +
"display: none;";
}
感谢您的进一步帮助。
【问题讨论】:
标签: css jsf onclick managed-bean