473,396 Members | 1,921 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,396 software developers and data experts.

bgColor error. What am I doing wrong?


I set up a table...

<table
bgcolor=#FF9966
name=msSel
onmouseover="msSel.bgColor='#FFCC66'"
onmouseout="differentFunction ();"
<tr><td>stuff</tr></td>
>
mouseout is eventully supposed to do several things,
only one of which is to reset the single cell table
color. A shortened function would be

function differentFunction (){

msSel.bgColor="#FF9966" ;
// other stuff here
} ;

on mouseout, a msSEL not found error is returned from
inside differentFunction.

substituting "this.bgColor" neither returns an error
nor changes the color. There are other reasons later
for not using "this" instead of specific names.

Why the error?
What is the correction or workaround?


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: do*@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com
Apr 24 '07 #1
4 1651
Don Lancaster said the following on 4/24/2007 11:58 AM:
>
I set up a table...

<table
bgcolor=#FF9966
name=msSel
onmouseover="msSel.bgColor='#FFCC66'"
onmouseout="differentFunction ();"
<tr><td>stuff</tr></td>
>

mouseout is eventully supposed to do several things,
only one of which is to reset the single cell table
color. A shortened function would be

function differentFunction (){

msSel.bgColor="#FF9966" ;
// other stuff here
} ;

on mouseout, a msSEL not found error is returned from
inside differentFunction.
<URL: http://jibbering.com/faq/index.html#FAQ4_41>

onmouseout="differentFunction(this)"

function differentFunction(elem){
elem.bgColor="#FF9966"
}

But, why do you quote in your function (which you should) but not in
your HTML (which you should) while using deprecated HTML3.2 bgcolor
(which you shouldn't). CSS is your friend.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 24 '07 #2
On Apr 24, 11:58 am, Don Lancaster <d...@tinaja.comwrote:
function differentFunction (){
msSel.bgColor="#FF9966" ;
this.style.backgroundColor = "#FF9966";

Kev

Apr 25 '07 #3
Kevin Darling said the following on 4/25/2007 6:36 PM:
On Apr 24, 11:58 am, Don Lancaster <d...@tinaja.comwrote:
> function differentFunction (){
msSel.bgColor="#FF9966" ;

this.style.backgroundColor = "#FF9966";
In that scenario? "this" doesn't refer to what you think it does. Test it :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 25 '07 #4
On Apr 25, 6:41 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Kevin Darling said the following on 4/25/2007 6:36 PM:
On Apr 24, 11:58 am, Don Lancaster <d...@tinaja.comwrote:
function differentFunction (){
msSel.bgColor="#FF9966" ;
this.style.backgroundColor = "#FF9966";

In that scenario? "this" doesn't refer to what you think it does. Test it :)
D'oh !! Yes, I know that. I posted very quickly before dinner and
mixed up editing two different answers. Shame on me!

Thanks for pointing it out :-)

Kev

Apr 26 '07 #5

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

Similar topics

1
by: Nat | last post by:
Hi I have following code: ----------------- protected override void Render(HtmlTextWriter w) { if (helpString!=null) { w.Write("<span class='tooltipiconouter'><img title =...
15
by: @sh | last post by:
Trying to do this, but its not working...?! My aim being to change the bgcolor of the cell upon which the user has rolled over, I'll then replicate this as an OnMouseOut to change it back. ...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
7
by: Brett | last post by:
I'm not sure why I keep getting this error, "Object reference not set to an instance of an object". Private Function somefunction() as string Dim MyCurrentClass As New Class1 Try For i As...
6
by: acord | last post by:
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...
6
by: GaryDean | last post by:
I need to be able to change the background color of a page from code. I found an answer to this question in another forum from Peter Huang that said that an id="bg" as follows... <body...
12
by: GaryDean | last post by:
In the original post I failed so indicate that I am using framework 1.1....... I need to be able to change the background color of a page from code. I found an answer to this question in...
5
by: Don Lancaster | last post by:
I am trying to change a group of background colors by calculating their names in a loop . Names are cfh13, cfh15, cfh17, etc... Unlooped code like cfh17.bgColor="#CCFFFF" ; works just fine....
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.