Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old November 28th, 2007, 02:18 PM   #1
New Member
 

Join Date: Mar 2007
Location: Long Island, NY
Age: 24
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 linchpin311 is on a distinguished road
[SOLVED] possible to manipulate onmouseout behavior?

Hi everyone!

I've got a page where visitors cast votes written mostly in php with html (tables, and a little css). There are two choices the visitor can vote for, and as a little effect, i thought it would be nice if when the visitor moused over their choice, the td background would change from a light blue, to a light green. furthermore, when the visitor clicked on their choice i wanted the td background to change from a light green (cause they placed the mouse over their selection) to an even lighter green.

i can get all of that to happen with this code inside of the td tag:
Code:
onmouseover="this.style.background='url(img/lightgreen.gif)'"
onmouseout="this.style.background='url(img/lightblue.gif)'"
onmousedown="this.style.background='url(img/lightergreen.gif)'"
what i cant get to happen is when the visitor clicks on their choice, because of the onmouseout the color goes back to the light blue.

is there any way that when the user clicks down on their choice, the background of the td stays that lighter green? ive got a very limited knowledge of javascript, and ive been having some trouble trying to explain the effect im looking for to google's search engine.

many thanks in advance!!
linchpin311 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 29th, 2007, 08:15 AM   #2
Highly Reputable Member
SuperMember
 
Rakuli's Avatar
 

Join Date: Sep 2007
Location: Australia
Age: 25
Posts: 954
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold Rakuli is a splendid one to behold
Re: possible to manipulate onmouseout behavior?

If they are selecting their choice, you can do a check as to whether the button is selected..

eg.

Code:
onmouseout="this.checked ? return : this.style.background='url(img/lightergreen.gif)'"
That will see whether the button has been clicked or not and won't change when the mouse is taken away
__________________
Luke Dingle . com
Rakuli is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old December 3rd, 2007, 04:45 PM   #3
New Member
 

Join Date: Mar 2007
Location: Long Island, NY
Age: 24
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 linchpin311 is on a distinguished road
Re: possible to manipulate onmouseout behavior?

thanks a lott!!!!

when i figured out how to work this into my code it worked like magic. many, MANY, thanks in helping me out.


this forumz great!
linchpin311 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
unordered list - strange behavior pesho318i HTML, XHTML and CSS 9 December 6th, 2007 10:19 AM
Strange form submit behavior in IE Donny Bahama PHP 3 April 27th, 2007 03:36 PM
onMouseOut happening also between cells clintxp JavaScript 3 March 28th, 2007 10:30 AM
Poor behavior for simple script in IE7 masonbarge JavaScript 4 February 5th, 2007 12:19 PM
Weird Opacity behavior in PS 7 autumn_whispers2me Graphic Specifics 0 May 3rd, 2005 06:24 PM


Search Engine Optimization by vBSEO 3.2.0 RC8