SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old June 17th, 2004, 10:23 AM
cornix cornix is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 8 cornix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cornix
JS table mouseover colorchange

Hey all

Am currently trying to write some table mousover effects. Am quite new to JavaScript, so I think it's some n00b-prob I have here.
Well, wrote some code which is successfully changing the class of a row in a table. it looks like this

Code:
...
tr.Highlight {
	background-color: lightblue;
	cursor:pointer;
}
...

Code:
...
function Highlight(id) { id.className='Highlight' }
...

in HTML:
Code:
...
<tr onmouseover="Highlight(this)">
...


Well, I tried to make it more usable, e.g. also for single cells and for css-classes i may define in the HTML-code. Changed it like this:

Code:
...
tr.Highlight {
	background-color: lightblue;
	cursor:pointer;
}
...

Code:
...
function Highlight(id,cssclass) { id.className=cssclass }
...

in HTML:
Code:
...
<tr onmouseover="Highlight(this,Highlight)">
...


But like this it's not working anymore. What did I do wrong? IE-debug tells me, Highlight is undefined. Tried if it works if I remove the tr in the css, but anyways it keeps giving out this error msg.
Think it's really some stupid newb-mistake. Pls help me

Reply With Quote
  #2  
Old June 17th, 2004, 01:16 PM
cornix cornix is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 8 cornix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cornix
RE: JS table mouseover colorchange

Still don't know why it's not working, but found a work-around. Instead od declaing a function, i'm putting this into the tag:

Code:
<tr onmouseover="this.className='cssclass'" onmouseout="this.className=''">


it's working fine!

Reply With Quote
  #3  
Old June 17th, 2004, 01:52 PM
cornix cornix is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 8 cornix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cornix
RE: JS table mouseover colorchange

And also resolved, why the different thing was not working.
Code:
<tr onmouseover="Highlight(this,Highlight)">

should be
Code:
<tr onmouseover="Highlight(this,'Highlight')">

then it works!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > JS table mouseover colorchange


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway