如果控件可见,如何编写JavaScript来检查条件,否则执行此操作 [英] How to write a javascript for checking condition if control is visible do this else do this

查看:100
本文介绍了如果控件可见,如何编写JavaScript来检查条件,否则执行此操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

我希望为以下内容编写JavaScript:

Dear,

I looking to write a javascript for:

If multiview.activeindex=0 then
button.backgroundcolor=something
else
something
end if


如何用javascript编写此代码.

请帮助我.


How to write this one in javascript.

Please help me.

推荐答案

<script type="text/javascript">
if (multiview.activeindex=0)
  {
  button1.background = "Red";
  }
else
  {
  button1.background = "White";
  }
</script>



使用一些好的例子中的以下链接和帮助;
JavaScript示例 [ ^ ]
http://www.w3schools.com/Js/js_if_else.asp [



Use following link et help from some good examples;
JavaScript Examples[^]
http://www.w3schools.com/Js/js_if_else.asp[^]


function checkVisible()
{
var button1=document .getElementById ("button1");
if(button1.visible=true)
{
button.backgroundcolor=something
else
{
button.backgroundcolor=something
}

}
}


function checkVisible()
{
var activeViewIndex = <%=MultiView1.ActiveViewIndex %>;
//& then your code
}


您也可以查看此链接
http://stackoverflow.com/questions/3300628/asp- net-multiview-check-activeviewindex-with-javascript-or-jquery [


Also you can check this link
http://stackoverflow.com/questions/3300628/asp-net-multiview-check-activeviewindex-with-javascript-or-jquery[^]


这篇关于如果控件可见,如何编写JavaScript来检查条件,否则执行此操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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