FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Anybody know how to code a mouseover?

 


newsarific
I kind of need one for my site.
Thanks!
MrBlueSky
Like this?

Code:

<HTML>
<HEAD>
<SCRIPT>

function msg() {
  var label = document.getElementById("label");
  label.innerHTML="Hello";
}

function clean() {
  var label = document.getElementById("label");
  label.innerHTML="";
}

</SCRIPT>
</HEAD>

<BODY>
<DIV onMouseOver="msg()" onMouseOut="clean()">Touch me</div>
<DIV id="label"></DIV>
</BODY>
</HTML>
aningbo
try a little google search and u will get even better ones...
dayveday
It's also possible to do this in pure CSS with the :hover class selector, so it will work without having to code any javascript. Mostly you can only change the look and background image of an element (which is perfect for buttons which get highlighted when you roll over), but you can do some content changes too if you're clever.

At the moment it will only work with anchor <a> elements in IE, unless you use something like the suckerfish plugin to help. But it will work with all elements in all the 'nice' browsers.
kevinalle
That code is quite simple, and not 100% correct.
You should declare var label outside the functions so it doesnt get re-declared on every mouseover/out event.

There are many ways of doing a mouseover.. it all depends on the complexity you want.
I choose CSS, with the :hover selector, because it is light and cross browser.
example:
Code:
<style type="text/css">
.button{
font-weight:bold;
font-family:Verdana;
}
.button:hover{
background-color:#ff6600;
color:#666666;
}
</style>

And then you just put:
Code:
<span class="button">Text here</span>

every time you want a button.
You might also like to choose JavaScript or even flash..
Good luck! Very Happy ,
K
kuclukzz
Hii, if you want to create mouse over event , try to use Dreamweaver MX or above . I'ts really easy to use .
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.