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

Simple Problem

I am trying to alternate the background colour of a cell in a table on
mouseover. The rollover function does switch based on the mi.value, but the
color does not change. Any ideas ?

Many Thanks

--------------------------------

<script language=javascript>

function rollover( mi )
{
if( mi.bgcolor=="Blue" )
{
mi.bgcolor = "White";
textboxy.value="White";
return true;
}

else

{
mi.bgcolor="Blue";
textboxy.="Blue";
return true;
}
}
</script>

</head>

<body>

<table id="menu" border="1" width="100%" id="table1">
<tr>
<td bgcolor="White" id="MI1" onmouseover="rollover(this);"
onmouseout="rollover(this);">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

Nov 9 '05 #1
13 1172

news.btinternnet.com wrote:
I am trying to alternate the background colour of a cell in a table on
mouseover. The rollover function does switch based on the mi.value, but the
color does not change. Any ideas ?

Many Thanks

--------------------------------

<script language=javascript>
The language attribute is deprecated use type instead:

<script type = "text/javascript">
function rollover( mi )
{
if( mi.bgcolor=="Blue" )
{
mi.bgcolor = "White";
textboxy.value="White";
return true;
}

else

{
mi.bgcolor="Blue";
textboxy.="Blue";
Did you mean textboxy.value = "Blue"; here?
return true;
}
Should be instead:

if(mi.style.backgroundColor == "blue")
{
mi.style.backgroundColor = "white";
return true;
}
else
{
mi.style.backgroundColor = "blue";
return true;
}
}

</script>

</head>

<body>

<table id="menu" border="1" width="100%" id="table1">
<tr>
<td bgcolor="White" id="MI1" onmouseover="rollover(this);"
onmouseout="rollover(this);">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>


Nov 9 '05 #2
Lee
news.btinternnet.com said:

I am trying to alternate the background colour of a cell in a table on
mouseover. The rollover function does switch based on the mi.value, but the
color does not change. Any ideas ?


What made you think that table cells have a property named "bgcolor"?

Change all references to "mi.bgcolor" to "mi.style.backgroundColor".
Also, fix the line that reads:

textboxy.="Blue";

Nov 9 '05 #3
Thanks very much, that worked a treat

Where are the style attributes listed, is there a url you could recommend

"web.dev" <we********@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...

news.btinternnet.com wrote:
I am trying to alternate the background colour of a cell in a table on
mouseover. The rollover function does switch based on the mi.value, but
the
color does not change. Any ideas ?

Many Thanks

--------------------------------

<script language=javascript>


The language attribute is deprecated use type instead:

<script type = "text/javascript">
function rollover( mi )
{
if( mi.bgcolor=="Blue" )
{
mi.bgcolor = "White";
textboxy.value="White";
return true;
}

else

{
mi.bgcolor="Blue";
textboxy.="Blue";


Did you mean textboxy.value = "Blue"; here?
return true;
}


Should be instead:

if(mi.style.backgroundColor == "blue")
{
mi.style.backgroundColor = "white";
return true;
}
else
{
mi.style.backgroundColor = "blue";
return true;
}
}

</script>

</head>

<body>

<table id="menu" border="1" width="100%" id="table1">
<tr>
<td bgcolor="White" id="MI1" onmouseover="rollover(this);"
onmouseout="rollover(this);">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

Nov 9 '05 #4
Thanks Lee.

Im a bit new to this, and Im getting confused between the HTML attributes
and the style settings, this is where the confusion was, i thought that I
could set the TD tag attributes his way as there is a bgColor on my
intellisense ( Front Page ) . Can you point me to a good reference on this.

"Lee" <RE**************@cox.net> wrote in message
news:dk********@drn.newsguy.com...
news.btinternnet.com said:

I am trying to alternate the background colour of a cell in a table on
mouseover. The rollover function does switch based on the mi.value, but
the
color does not change. Any ideas ?


What made you think that table cells have a property named "bgcolor"?

Change all references to "mi.bgcolor" to "mi.style.backgroundColor".
Also, fix the line that reads:

textboxy.="Blue";

Nov 9 '05 #5
news.btinternnet.com wrote on 09 nov 2005 in comp.lang.javascript:
function rollover( mi )
{
if( mi.bgcolor=="Blue" )
{
mi.bgcolor = "White";
textboxy.value="White";
return true;
}

else

{
mi.bgcolor="Blue";
textboxy.="Blue";
return true;
}
}


function rollover( mi ){
if(mi.bgcolor == "Blue") {
mi.bgcolor = textboxy.value = "White"; // if you like ;-)
return;
// onmouseove and onmouseout do not use the return value
}
// no "else" neccessary after a return
mi.bgcolor = textboxy.value = "Blue";
// no return necessary at end of function
}


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 9 '05 #6
news.btinternnet.com wrote:
Thanks very much, that worked a treat

Where are the style attributes listed, is there a url you could recommend


Trim quotes to only what you are replying to, and reply below the quoted
text.

HTML attributes are listed here as part of the HTML specification (there
is a link at the top and bottom of the page):

<URL:http://www.w3.org/TR/html4/>

The CSS 2 specification is here - Appendix F lists all the properties:

<URL:http://www.w3.org/TR/CSS21/>

The rule for accessing properties of an element's style object is to
remove hyphens and capitalise the next letter, e.g. 'background-color'
becomes 'backgroundColor' and 'border-right-width' becomes
'borderRightWidth'.

There are handy compact references here:

<URL:http://www.w3schools.com/css/css_reference.asp>

<URL:http://developer.mozilla.org/en/docs/DOM:CSS>

The Mozilla link appears to be a work in progress - neither link is
authoritative, always check the spec.
[...]
--
Rob
Nov 9 '05 #7
Rob,

That's exactly what I was looking for, thank you for those excellent
references which I am going to add to my favourites lists.

Best Regards

"RobG" <rg***@iinet.net.au> wrote in message
news:5u***************@news.optus.net.au...
news.btinternnet.com wrote:
Thanks very much, that worked a treat

Where are the style attributes listed, is there a url you could recommend


Trim quotes to only what you are replying to, and reply below the quoted
text.

HTML attributes are listed here as part of the HTML specification (there
is a link at the top and bottom of the page):

<URL:http://www.w3.org/TR/html4/>

The CSS 2 specification is here - Appendix F lists all the properties:

<URL:http://www.w3.org/TR/CSS21/>

The rule for accessing properties of an element's style object is to
remove hyphens and capitalise the next letter, e.g. 'background-color'
becomes 'backgroundColor' and 'border-right-width' becomes
'borderRightWidth'.

There are handy compact references here:

<URL:http://www.w3schools.com/css/css_reference.asp>

<URL:http://developer.mozilla.org/en/docs/DOM:CSS>

The Mozilla link appears to be a work in progress - neither link is
authoritative, always check the spec.
[...]
--
Rob

Nov 10 '05 #8
"news.btinternnet.com" <he**@now.com> writes:
Rob,

That's exactly what I was looking for, thank you for those excellent
references which I am going to add to my favourites lists.

Best Regards

"RobG" <rg***@iinet.net.au> wrote in message
news:5u***************@news.optus.net.au...
news.btinternnet.com wrote:
Thanks very much, that worked a treat

Where are the style attributes listed, is there a url you could recommend


Trim quotes to only what you are replying to, and <===== Here ====
reply below the quoted text. <===== Here ====
[...]


Please consider what Rob has written.
Always reply _below_ the quoted text, thanks :)

Arnaud
Nov 10 '05 #9
1.) What you are talking about.
2.) Who died and made you boss ?

Hold on, forget 1.)

END.
"aundro" <ad@ionicsoft.nobsplz.com> wrote in message
news:87************@paddy.ionicsoft.com...
"news.btinternnet.com" <he**@now.com> writes:
Rob,

That's exactly what I was looking for, thank you for those excellent
references which I am going to add to my favourites lists.

Best Regards

"RobG" <rg***@iinet.net.au> wrote in message
news:5u***************@news.optus.net.au...
news.btinternnet.com wrote:
Thanks very much, that worked a treat

Where are the style attributes listed, is there a url you could
recommend

Trim quotes to only what you are replying to, and <===== Here ====
reply below the quoted text. <===== Here ====
[...]


Please consider what Rob has written.
Always reply _below_ the quoted text, thanks :)

Arnaud

Nov 10 '05 #10
"news.btinternnet.com" <he**@now.com> writes:
1.) What you are talking about.
2.) Who died and made you boss ?

Hold on, forget 1.)

END.


It's actually pretty hard to keep willing to help people who actually
need it when one faces such behaviour..

Arnaud
Nov 10 '05 #11
Hold on a minute.

I find your post to be intrusive and confusing. You appear at the end of a
thread which was perfectly polite and try and lay down the law in a way
which was frankly unclear.

You talk about helping me, I dont see what help you provided, which is
different from the other posters who were most helpful.

If I have offended you, then you should not be so sensitive. If you had
helped me in some way then I probably would have accepted your comments ( if
they were understandable ) as it stands, it really feels as if you were just
poking your nose in with no real benefit.

"aundro" <ad@ionicsoft.is.my.workplace.com> wrote in message
news:87************@paddy.ionicsoft.com...
"news.btinternnet.com" <he**@now.com> writes:
1.) What you are talking about.
2.) Who died and made you boss ?

Hold on, forget 1.)

END.


It's actually pretty hard to keep willing to help people who actually
need it when one faces such behaviour..

Arnaud

Nov 10 '05 #12
news.btinternnet.com wrote:
I find your post to be intrusive and confusing.
I find you intrusive, but not really confusing. People with that antisocial
attitude come here often and go even more quickly. Not having you here
will be no real loss for this group.
[Top posting again]

PointedEars
Nov 10 '05 #13
Oh do be quiet and go back to Michael Jackson, apparently he likes people
with pointed ears.
"Thomas 'PointedEars' Lahn" <Po*********@web.de> wrote in message
news:10******************@PointedEars.de...
news.btinternnet.com wrote:
I find your post to be intrusive and confusing.


I find you intrusive, but not really confusing. People with that
antisocial
attitude come here often and go even more quickly. Not having you here
will be no real loss for this group.
[Top posting again]

PointedEars

Nov 10 '05 #14

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

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
6
by: francisco lopez | last post by:
ok , first of all sorry if my english is not so good, I do my best. here is my problem: I donīt know much javascript so I wrote a very simple one to validate a form I have on my webpage. ...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
18
by: Sender | last post by:
Yesterday there was a very long thread on this query. (You can search on this by post by 'sender' with subject 'Simple Problem' post date Oct 7 time 1:43p) And in the end the following code was...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
2
by: Vitali Gontsharuk | last post by:
Hi! I have a problem programming a simple client-server game, which is called pingpong ;-) The final program will first be started as a server (nr. 2) and then as a client. The client then...
8
by: rdrink | last post by:
I am just getting into pysqlite (with a fair amount of Python and MySQL experience behind me) and have coded a simple test case to try to get the hang of things... yet have run into a 'stock...
5
by: Chelong | last post by:
hey,the follow is the text file content ========================================apple====pear== one Lily 7 0 0 7 7 two Lily 20 20 6.6666 20 8 one Lily 0 10 2.85 4 0 two Lily 22 22 7.33326 2 5 ...
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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:
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...

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.