473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

This is my UserControl(ascx) coding, it is not working plz help me to rectify the error.....what is wrong in that one.....

<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Usea.ascx.vb" Inherits="HIS.Usea" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<script language="javascript" type="text/javascript">
function output()
{
var xx = document.getElementsByName("cbtest").value;
// var xx=document.forms.item('cbtest');
//document.m
//var xx= document.forms.cbtest.checked= true;
// var mainForm=document.mainForm.cbtest;
if (xx.checked ==true)
{
document.getElementById("Panel1").style.background Color= "#ffff00";
return true;
}
if(xx.checked == false)
{
document.getElementById("Panel1").style.background Color= "#90dd90";
return false;
}
}
</script>
<asp:panel id="Panel1" BackColor="YellowGreen" runat="server" Width="56px" Height="40px" BorderStyle="None"
ToolTip="seat">
<asp:Image id="Image1" runat="server" Width="32px" Height="32px" ImageAlign="Middle" ImageUrl="file:///\\system107\HIS\Images\seat2.jpg"></asp:Image>
<INPUT id="cbtest" onclick="output()" type="checkbox" name="cbtest" runat="server">
<asp:Label id="Label1" runat="server" Width="32px" Font-Size="X-Small" Font-Names="Verdana"></asp:Label>
</asp:panel>
May 5 '07 #1
2 1385
kenobewan
4,871 Expert 4TB
What error are you getting?
May 5 '07 #2
What error are you getting?

'Checked' is null or not an object
May 5 '07 #3

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

Similar topics

4
by: Alexandre Jaquet | last post by:
Hi, I would like to know how can I change a row background color when an user select a row thx
7
by: ThunderMusic | last post by:
Hi, I have a CheckBoxList and I want to add some javascript code to each CheckBox created by this CheckBoxList. I tried iterating through all items of the list, all the controls, do a FindControl,...
3
by: Softimax | last post by:
Hi! I want to change the position of a generic control. I want to append it to a different parent. I try some methods but I have some problem with complex controls (like dropdown, checkboxlist) ...
10
by: apparker | last post by:
I'm creating a new GUI for a program and it is for a medical exam. There are so many different things to ask someone during a history it wastes too much space to make checkboxes for everything so I...
1
by: itsenthil | last post by:
This is my Usercontrolcoding. what is wrong in this coding plz help me <script type="text/javascript" language="javascript"> function output() { var cb...
2
by: itsenthil | last post by:
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..... <%@ Control Language="vb"...
0
by: Abbas82 | last post by:
Hi, I have a nested DIV structure where both have an onclick event, hence I am cancelling the event from bubbling up to the outer DIV, but this has caused the Panel to remain opened when I click...
3
by: dugald.morrow | last post by:
I have some javascript that updates the text in a text field after certain actions take place such as clicking a checkbox. The javascript works fine in Safari and Firefox, but in IE, the text in...
5
by: sklett | last post by:
I know that Panel (and most of it's derivitives) don't raise keyboard events. I *really* need to catch keyboard events though so I've been googling the topic and have found quite a few...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.