问题描述
我要禁用客户端网站上的LinkButton
碰杯。
I want to disable a LinkButton
clink on the client site.
objLinkButton.disabled = true;
// or
objLinkButton.disabled = -1;
这将禁用链接,但我依然能够点击链接,做回发。
This disables the link but I am still able to click on the link and do PostBack.
有什么办法我可以禁用链接。
Is there any way I can disable the link.
code:
<asp:linkbutton id="xyz" runat="server"
onClick="javascript:LinkDisable(this)" ></asp:linkbutton>
这使得作为不回发...我打开页面上回发在新窗口中的链接。
我想要做的是..当我点击的链接firsttime上..这将打开一个新页面,然后将禁用的链接。
which renders as a link which does a postback... I am opening the page on postback in a new window.What I want to do is.. when I click on the link for the firsttime.. it will open a new page and then it will disable the link.
我在做什么是..这环节我有一个JavaScript函数的onClick ..这是这样的..
what I am doing is .. onClick of that link I have a javascript function.. which is something like this..
在LinkDisable ...
In LinkDisable ...
function LinkDisable(obj)
{
obj.disabled = -1;
obj.href = '#';
//Cant return false from here.. otherwise it wont postback...
}
当我这样做..链接获取灰色的了......但是我仍然可以点击它。我想从单击它第二次停止用户。
When I do this.. the link gets grey's out ... but I am still able to click it. I want to stop the user from clicking it the second time.
任何帮助是AP preciated。
Any help is appreciated.
推荐答案
找到了解决办法家伙......这些JavaScript的解决方案将工作,但如果你刷新页面...它会清除varaibles。
Found the Solution guys... these javascript solution will work but if you refresh the page... it will clear the varaibles.
因此是一个错误在那里..
So thats a bug right there..
找到使用用户数据的解决方案... IE浏览器会话的数据......这真的很酷。
Found the solution using "userData" ... IE Session data... it really cool.
结帐此链接:
这篇关于禁用的LinkButton不会禁用JavaScript中的单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!