使用Java显示/隐藏tr [英] To show/Hide tr using Javascript

查看:61
本文介绍了使用Java显示/隐藏tr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



编写以下Javascript来显示和隐藏tr区域,但是当其触发时,tr区域将再次打开和关闭.

如果错误,请更正我的代码.

Hi

The following Javascript is written to show and hide a tr region but when its firing the tr region opens and closes again.

Kindly correct my code if wrong .

function ShowHide() {
           var trid = document.getElementById("tr_View_Filter_Template_List");
           if (trid != null) {
               if (trid.style.display == "block") {
                   trid.style.display = 'none';
               }
               else {
                   trid.style.display = 'block';
               }
           }
       }



调用Java脚本的C#代码

lnView_Filter_Template_List.Attributes.Add(General_Constants.onclick,"ShowHide();");



C# Code to Call Javascript

lnView_Filter_Template_List.Attributes.Add(General_Constants.onclick, "ShowHide();");

推荐答案

我看不到您的代码有任何问题,可能是该函数以某种方式被连续两次调用.在您的函数中放置一个警报,该警报应告诉您是否被两次调用.
I don''t see any problem with your code, it could be that this function is somehow called twice in succession. Put an alert in your function and that should tell you if it is called twice.


您好,
谢谢大家 .
问题是我使用了链接按钮,由于每次单击都会发生回发.更改为超链接后,问题已解决.
Hi
Thanks to All .
The problem was that i used a link button due to which postback happened every time when i clicked . after Changing to Hyperlink the issue is Solved .


这篇关于使用Java显示/隐藏tr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆