By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

I want change the color of the panel if i click checkbox using javascript

P: 8
This is my userControl(ascx) file if run this one i got object required error........

What is wrong in that one plz help me....it is very urgent.....

Expand|Select|Wrap|Line Numbers
  1. <%@ Control Language="vb" AutoEventWireup="false" Codebehind="Usea.ascx.vb" Inherits="HIS.Usea" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
  2. <script type="text/javascript" language="javascript">
  3.         function output()
  4.         {
  5.          var xx = document.getElementById("cbtest").value;
  6.         //var mainForm=document.mainForm.id("cbtest");
  7.         if (xx.checked == true) 
  8.         {
  9.         document.getElementById("Panel1").style.backgroundColor= "#ffff00";
  10.         return true;
  11.         }
  12.         if (xx.checked == false) 
  13.         {
  14.         document.getElementById("Panel1").style.backgroundColor= "#9acd32";
  15.         return false;
  16.         }
  17.        }
  18. </script>
  19. <asp:panel id="Panel1" BackColor="YellowGreen" runat="server" Width="56px" Height="40px" BorderStyle="None"
  20.     ToolTip="seat">
  21.     <asp:Image id="Image1" Height="32px" Width="32px" runat="server" ImageUrl="file:///\\system107\HIS\Images\seat2.jpg"
  22.         ImageAlign="Middle"></asp:Image>
  23.     <INPUT id="cbtest" onclick="output()" type="checkbox" name="cbtest" runat="server">
  24.     <asp:Label id="Label1" Width="32px" runat="server" Font-Names="Verdana" Font-Size="X-Small"></asp:Label>
  25. </asp:panel>
May 8 '07 #1
Share this Question
Share on Google+
2 Replies


RedSon
Expert 5K+
P: 5,000
Moving to VB since its coded in VB. This might need to move around further but I'll let the helpful folks in VB take a shot at it first.
May 8 '07 #2

P: 8
Moving to VB since its coded in VB. This might need to move around further but I'll let the helpful folks in VB take a shot at it first.

ok Thanks....
May 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.