onmouseover change div |
onmouseover change div |
Ozonez |
Mar 18 2007, 10:47 AM
Post
#1
|
Group: Members Posts: 1 Joined: 18-March 07 Member No.: 2,240 |
Okay, what im looking for is for a DIV (with text in it) to appear when a user places their mouse over a piece of text. Also for this DIV not to dissapear when the mouse if removed. But if the User places their mouse over another piece of text that shows a DIV, it replaces the already shown DIV.
Any help is appreciated. |
Effovex |
Mar 18 2007, 04:35 PM
Post
#2
|
Serious Coder Group: Members Posts: 251 Joined: 6-January 07 From: Sherbrooke, Qc, Canada Member No.: 1,477 |
Quick and dirty version, edit to fit your needs.
CSS: HTML <style type="text/css" media="all"> #a1,#a2 { position: fixed; top: 0; right: 0; width: 100px; height: 100px; visibility: hidden; } </style> java script: HTML <script type="text/javascript"> numberofdivs = 2; function showdiv(id) { for(i = 1; i > numberofdivs; i++) { element = document.getElementByID("a"+i); if(i == id) element.style.visibility = "visible"; else element.style.visibility = "hidden"; } } </script> in the HTML HTML <p><em onClick="showdiv(1)">Click me</em> or <strong onClick="showdiv(2);">or me!</strong></p> <div id="a1">Some stuff</div> <div id="a2">Different Stuff</div> This post has been edited by Effovex: Mar 18 2007, 04:39 PM |
Lo-Fi Version | Time is now: 24th April 2024 - 10:54 AM |