[SOLVED] Text rollover

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



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

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 23rd, 2007, 03:05
New Member
Join Date: Nov 2007
Location: pt
Age: 22
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Text rollover

Hi there,

I have a doubt here, hope you can help me.

This is the code:

<script>
function sw(y,x){
t=document.getElementById(x).style
t.visibility=(y=='on')?'visible':'hidden'
}
</script>
<style>
#div1,#div2 {
visibility:hidden;
left: 292px;
top: 45px;
}
</style>
<a onmouseover=sw('on','div2')>Show</a>
<div id=div2>This is a test.</div>

So..
What I want to do is, when I rollover on text another text would appear, and it does. But it stays like that when I move the mouse away from the text, and I wanted the text that appeared to disappear again.

Can you help me? I'd appreciate it. Thanks for your time.
Reply With Quote

  #2 (permalink)  
Old Nov 23rd, 2007, 03:41
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Text rollover

Just put an onmouseout value into the anchor tag (<a>). Like this:
HTML: Select all
<a onmouseover="sw('on','div2')" onmouseout="sw('off','div2')">Show</a>
That's it! I tested it, and it works, but if you have any problems, just ask...

Cheers
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #3 (permalink)  
Old Nov 23rd, 2007, 09:53
New Member
Join Date: Nov 2007
Location: pt
Age: 22
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Text rollover

Thanks man that's exactly it, I was trying to do that like:

<a onmouseover="sw('on','div2')">Show</a>
<a onmouseout="sw('off','div2')"></a>

I didn't know that it could be done in the same..

Appreciate it
Reply With Quote
  #4 (permalink)  
Old Nov 23rd, 2007, 13:41
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: [SOLVED] Text rollover

No problem. Glad to help
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
Reply

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
Hover over text to rollover an image? Dapandyman Web Page Design 3 Feb 24th, 2008 08:12
[SOLVED] Image with text -&gt; text with background alexgeek Web Page Design 5 Nov 13th, 2007 23:25
[SOLVED] css rollover menu help danny322 Web Page Design 7 Oct 23rd, 2007 13:58
CSS imagemap with text rollover geoffmuskett Web Page Design 32 Aug 9th, 2006 15:42
Highlight text Box on rollover timmytots Web Page Design 3 Nov 24th, 2005 21:14


All times are GMT. The time now is 19:24.


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