473,399 Members | 3,888 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,399 software developers and data experts.

change bgColor

Hi,

I want to change the background color of a ul/li row, but the following
code is not working as I expected. It works in <table><tr>...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<style type="text/css">
#css_table {font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px; color:003366;}

#css_table ul {
padding: 0;
margin: 0;
list-style: none;
line-height:24px;
clear:both;
}

#css_table ul li {
padding:2px 8px 2px 8px;
width:auto;
border:1px solid #333333;
float:left;
}
</style>
<body>

<div id="css_table">
<ul onMouseOver="this.bgColor = '#C0C0C0'" onMouseOut ="this.bgColor =
'#FFFFFF'" bgcolor="#FFFFFF">
<li style="width:400px;">Jim</li>
<li>The</li>
<li>Fun</li>
<li>Begins</li>
<li><!-- Put Icon --> Here</li>
</ul>
<ul onMouseOver="this.bgColor = '#C0C0C0'" onMouseOut ="this.bgColor =
'#FFFFFF'" bgcolor="#FFFFFF">
<li style="width:400px;">Jim</li>
<li>The</li>
<li>Fun</li>
<li>Begins</li>
<li>Here</li>
</ul>
<ul onMouseOver="this.bgColor = '#C0C0C0'" onMouseOut ="this.bgColor =
'#FFFFFF'" bgcolor="#FFFFFF">
<li style="width:400px;">Jim</li>
<li>The</li>
<li>Fun</li>
<li>Begins</li>
<li>Here</li>
</ul>
</div>

</body>
</html>
Mar 10 '06 #1
6 3713
On Sat, 11 Mar 2006 01:13:25 +1100, acord <ac***@telpacific.com.au>
wrote:
the following
code is not working as I expected

</head>
<style type="text/css">


Hi acord. The <style> section belongs in the <head> section. Right now
you have it in the <body> section.

Ian
--
http://sundry.ws/
Mar 10 '06 #2
On Fri, 10 Mar 2006 14:28:36 GMT, Ian Rastall <id*******@gmail.com>
wrote:
The <style> section belongs in the <head> section. Right now
you have it in the <body> section.


Or, rather, it's inbetween the <body> and <head> sections, which is a
no-man's land. Nothing should be inbetween those two sections.

HTH HAND,

Ian
--
http://sundry.ws/
Mar 10 '06 #3
Ian Rastall wrote:
On Fri, 10 Mar 2006 14:28:36 GMT, Ian Rastall <id*******@gmail.com>
wrote:

The <style> section belongs in the <head> section. Right now
you have it in the <body> section.

Or, rather, it's inbetween the <body> and <head> sections, which is a
no-man's land. Nothing should be inbetween those two sections.

HTH HAND,

Ian

does it work at your end? it doesn't make may differnet here.

Thanks
A
Mar 10 '06 #4
On Sat, 11 Mar 2006 10:35:41 +1100, acord <ac***@telpacific.com.au>
wrote:
does it work at your end? it doesn't make may differnet here.


I apologize, I didn't check your code. Just trust me that the first
thing you have to do is put the <style> section in your <head>
section, though where is unimportant, as long as it's nested inside
<head>. After that, then work on the actual CSS.

Not to talk down to you, but to put it in basic terms, there is one
<html> section, with only two sections allowable inside it: <head> and
<body>. Everything goes inside one of those two. Nothing else is
allowed.

Ian
--
http://sundry.ws/
Mar 10 '06 #5
Ian Rastall wrote:
On Sat, 11 Mar 2006 10:35:41 +1100, acord <ac***@telpacific.com.au>
wrote:

does it work at your end? it doesn't make may differnet here.

I apologize, I didn't check your code. Just trust me that the first
thing you have to do is put the <style> section in your <head>
section, though where is unimportant, as long as it's nested inside
<head>. After that, then work on the actual CSS.

Thaks not the source of causing the problem.

Thanks
A Not to talk down to you, but to put it in basic terms, there is one
<html> section, with only two sections allowable inside it: <head> and
<body>. Everything goes inside one of those two. Nothing else is
allowed.

Ian

Mar 11 '06 #6
acord wrote:
this.bgColor = '#C0C0C0'


This is off-topic in this group. Try a stylesheet or Javascript group.

That having been said, try:

this.style.backgroundColor='#C0C0C0';

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Mar 11 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: kj | last post by:
Is there a way to dynamically (e.g. upon onClick) change the bgColor attribute of a table cell? I tried cell.setAttribute("bgColor", someColor), where someColor was a string of the form "#RRGGBB",...
2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance...
2
by: cs168 | last post by:
Hi I am new in ASP programming so I do use the very basic and simple way to do all my stuff. Now I do really got stuck at how can I loop thru the calculation for all my selection.. My full code is as...
1
by: CYShao | last post by:
How to change the BGcolor of DateTimePicker ? I fialed to find any attributes of this, but only found BGcolor of calendar. How can I change the BGcolor of DateTimePicker window? Thanks CYShao
7
by: Cliff Cavin | last post by:
How do I programatically change the background color of an aspx page in code? Is there something like Page.BgColor = "#FFFFFF" ? For that matter, how do I access any of the DOCUMENT...
2
by: sam | last post by:
Hello Group, I have a table which consists of few web datagrids. Based on certain condition, I want to change the table bgcolor from the code behind. Any help would be great!! Thanks, Sam.
3
by: rlueneberg | last post by:
I want to change the color of an "a" child element inside a table cell via javascript. Is there any way to do that? Ps: there is no id assigned to child elements. I would like to discover the child...
4
by: gregincolumbus | last post by:
I am trying to get the financial calculation on this to trigger whenever there is a change to select1. Right now, the user has to click on select2 to trigger the changes. Ideally, a change of...
10
by: LayneMitch via WebmasterKB.com | last post by:
Hello. I'm trying to figure out why this isn't working... <html><head><title>Prob.11</title> <script type="text/javascript"> function attachHandlers { var...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.