OnMouseOver

This is a discussion on "OnMouseOver" within the JavaScript Forum section. This forum, and the thread "OnMouseOver are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 4th, 2005, 20:02
New Member
Join Date: Mar 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kookie09
OnMouseOver

hey, I want to be able to change text to an image when the user puts thier mouse over it, is this possible without using another image instead of text?? Anyone know how?

  #2 (permalink)  
Old Apr 4th, 2005, 22:04
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
There's a couple ways to do it, one would be to use the onmouseover event on a div containing the text, then use .innerHTML to change the contents of the div to an image, and back again for the mouseout.
  #3 (permalink)  
Old Apr 4th, 2005, 22:11
New Member
Join Date: Mar 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kookie09
ok

could you give me a sample code possibly?? I'm still a bit confused.
  #4 (permalink)  
Old Apr 5th, 2005, 03:59
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
This is about a medium complex way to do it.

This goes in the HEAD:
Code: Select all
<script type="text/javascript">
	function swapimg(d,i) {
		this.innerHTML = '[img]' + i + '[/img]';
	}
	function swaptext(d,s) {
		this.innerHTML = s;
	}
</script>
This in the BODY:
Code: Select all
<div id="d1" onmouseover="swapimg('d1','myimage.gif');" onmouseout="swaptext('d1','Something');">Something</div>
  #5 (permalink)  
Old Apr 7th, 2005, 02:08
New Member
Join Date: Mar 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kookie09
Thanks!

Thanks a TON.. now that I see it its coming back to me.. works GREAT!
  #6 (permalink)  
Old Apr 21st, 2005, 23:20
New Member
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
a better way is to instead just hide the Div element, that way your borwser does not need to redraw/or redownload the image as in the case of bad rollovers.
Closed Thread

Tags
onmouseover

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
popup div onmouseover pesho318i JavaScript Forum 2 Dec 28th, 2007 13:30
onmouseover not working in ff dab42pat JavaScript Forum 4 Nov 30th, 2007 14:10
onMouseOver <div> pops up next to mouse pointer - HOW? Love2Java JavaScript Forum 17 Aug 1st, 2007 19:42
onMouseOver Help Bighen JavaScript Forum 3 Jan 24th, 2006 20:17
OnMouseOver Action Monie JavaScript Forum 10 Dec 30th, 2004 10:19


All times are GMT. The time now is 22:45.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43