本文介绍了如果Javscript消息框即将到来,则会显示Hiden Div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 嗨朋友们,我对asp.net网络应用程序有一点怀疑 我有两种类型菜单的2个div,即所有用户的一个菜单除了管理员登录和其他 菜单用于管理员登录,因为我已经使用了这个我只想给予一些权限 用户和Admin的所有权限。 为此我采取了2个div,其中所有都是HTML菜单代码。基于会话价值我是隐藏菜单的 。每件事都很好,但是我使用的一个小问题javascript ajax 用于调用Web服务,所以当任何警报消息出现时,我是 隐藏在该特定会话中也是可见的,直到我按下消息框确定或取消按钮。 怎么能我解决了这个问题,我想要两个菜单也用于我的逻辑。有什么方法可以解决这个问题吗? 请任何人都可以帮我解决这个问题 谢谢和问候 Ganesh 解决方案 嗨Ganeshcse, 是的,有一种方法。我的项目遇到了同样的问题。 您可以在服务调用之前定义一个javascript方法,并隐藏意外生成的div控件。 我与你分享我的代码以供参考。 我在弹出窗口中添加了以下代码来隐藏不需要的按钮。 //检查项目和 >调用 javascript 功能 隐藏不需要的按钮图像。 if (CurrentDealStatus == Constant.REGISTRATION_REJECTED || CurrentDealStatus == Constant.PROJECT_WON || CurrentDealStatus == Constant.PROJECT_SAVE || CurrentDealStatus = = Constant.REGISTRATION_APPROVE || CurrentDealStatus == Constant.REQUIRES_REVISION) ScriptManager.RegisterStartupScript(this,this。 GetType (), UserWaitingApprovalButtonHide, < script type ='text / javascript'> UserWaitingApprovalButtonHide();< / script>, false ); 客户端脚本功能如下。 function UserWaitingApprovalButtonHide(){ ( #dvSave)。hide(); ( #dvSaveSubmit)。hide(); Hi friends, I have small doubt in asp.net web appI have 2 divs for 2 types of menu''s i.e one menu for All Users except Admin Login and Other Menu is for Admin Login because I have used this I want to give only some permissions to users and all permissions to Admin. For that I have taken 2 div''s in which all is HTML Menu Code. based on Session value I am hiding the menu. every thing is fine but one small problem that I am using javascript ajax functions to call web service so when any alert message comes the other menu which I was hiding for that particular session is also visible till I press the message box Ok or Cancel Button.How can I solve this and I want two menu''s also for my logic. Is there any method to solve this?Please any one can help me with this problemThanks & RegardsGanesh 解决方案 Hi Ganeshcse,Yes there is one way. I had the same problem faced in my project.You can define one more javascript method before the service call and hide the div control that is been produced unexpectedly. I am sharing my code with you for reference. I had added the following code to hide the unwanted buttons during the popup show.//Check sataus of the project and call javascript function for hide the unwanted button Image. if (CurrentDealStatus == Constant.REGISTRATION_REJECTED || CurrentDealStatus == Constant.PROJECT_WON || CurrentDealStatus == Constant.PROJECT_SAVE ||CurrentDealStatus==Constant.REGISTRATION_APPROVE || CurrentDealStatus==Constant.REQUIRES_REVISION)ScriptManager.RegisterStartupScript(this, this.GetType(),"UserWaitingApprovalButtonHide", "<script type='text/javascript'>UserWaitingApprovalButtonHide();</script>", false);The client script function is as follows.function UserWaitingApprovalButtonHide() {("#dvSave").hide();("#dvSaveSubmit").hide(); 这篇关于如果Javscript消息框即将到来,则会显示Hiden Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-10 08:31