Click here to Skip to main content
15,899,937 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Dear,

I looking to write a javascript for:
VB
If multiview.activeindex=0 then
button.backgroundcolor=something
else
something
end if

How to write this one in javascript.

Please help me.
Posted
Updated 8-Jan-12 22:36pm
v2

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


Use following link et help from some good examples;
JavaScript Examples[^]
http://www.w3schools.com/Js/js_if_else.asp[^]
 
Share this answer
 
Comments
Jagadeesh Bollabathini 9-Jan-12 5:30am    
This is not working
can you please
describe it briefly

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

}
}
 
Share this answer
 
Comments
Jagadeesh Bollabathini 9-Jan-12 5:24am    
Can replace it for multiview i.e
if mltviw.Activeviewindex=0 then
button1.bordercolor=red
else
something else
end if

Please replay me

thank you
Jagadeesh Bollabathini 9-Jan-12 23:44pm    
I am not getting
button1.backgroundcolor--- property

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

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

Try following

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



Hopw this helps..
 
Share this answer
 
JavaScript
var MultiView =  document.getElementById('<%=MultiView1.ClientID %>');
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900