如果先前已选择如何将其他Gridrow的颜色更改为默认颜色,以及如何将当前Gridrow的颜色更改为黄色 [英] how to change the color of other gridrow to default if it is previously select and make the current gridrow color to yellow

查看:97
本文介绍了如果先前已选择如何将其他Gridrow的颜色更改为默认颜色,以及如何将当前Gridrow的颜色更改为黄色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

function ChangeRowColor(rowID)
        {

            var color = document.getElementById(rowID).style.backgroundColor;

              if (color == 'yellow')
                  document.getElementById(rowID).style.backgroundColor="white";
              else
                  document.getElementById(rowID).style.backgroundColor ="yellow";
            }




例如:考虑到一旦选择了第一行,我就有两个网格行,则颜色必须更改为黄色,如果我选择了第二个网格行,则它应更改为黄色,并且第一行必须更改为其默认颜色...
请帮助...




ex: consider i have two gridrows once the 1st row is selected the color has to change to yellow and if i select the 2nd gridrow then it should change to yellow and the 1st row must be changed to its default color...
please help...

推荐答案

从何处调用此方法?最简单的方法是在绑定事件期间将所有行重置为默认行,然后仅更新特定行.
Where is this method being called from? The simplest way would be to reset all rows to the default, possibly during the binding event, then only update the specific row.


这篇关于如果先前已选择如何将其他Gridrow的颜色更改为默认颜色,以及如何将当前Gridrow的颜色更改为黄色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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