gpt4 book ai didi

javascript - XPages:如何禁用重复控件中的按钮

转载 作者:行者123 更新时间:2023-11-30 16:49:47 25 4
gpt4 key购买 nike

我在我的 XPage 中使用了一个重复控件,其中包含一些重复的按钮。

我怎样才能控制单个按钮或在单击后淡出特定按钮?我什至在客户端的 onClick 上尝试了以下代码,但它没有用

var id = dojo.query("[id='ActionBtn']")[0];
id.setDisabled(true);

最佳答案

使用 #{id:ActionBtn} 获取客户端 ID 并使用它来获取按钮元素以禁用它:

document.getElementById("#{id:ActionBtn}").disabled=true

或点击后隐藏

document.getElementById("#{id:ActionBtn}").style.visibility='hidden'

document.getElementById("#{id:ActionBtn}").style.display='none'

例子:

<xp:repeat
id="repeat1"
rows="30">
<xp:this.value><![CDATA[#{javascript:[1,2,3,4]}]]></xp:this.value>
<xp:button
value="Label"
id="ActionBtn">
<xp:eventHandler
event="onclick"
submit="false">
<xp:this.script><![CDATA[
document.getElementById("#{id:ActionBtn}").style.display='none'
]]></xp:this.script>
</xp:eventHandler>
</xp:button>
<br />
</xp:repeat>

关于javascript - XPages:如何禁用重复控件中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30704122/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com