• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] I need help with my index.

Status
Not open for further replies.

Kekox

Well-Known Member
Joined
Apr 4, 2009
Messages
1,264
Reaction score
60
Location
Venezuela
Well I want to add a image in my index that when you pass your mouse over it, it change the image and when your mouse is out it just change back.

How can I do that?
 
javascript, onmouseover & onmouseout.
 
May I recommend you to use CSS instead of JavaScript? If you do, the images will be loaded with the server, and not with the client (gives a flicker-free effect).

Code:
<div class="rollover"></div>
Code:
div.rollover {
     height: 100px;
     width: 100px;
     background: url('myImage.png') no-repeat;
}
div.rollover:hover {
     background: url('myHoverImage.png') no-repeat;
}
 
Thanks! ;D but I dont know where to paste that..?

And where should I paste the images?
 
Last edited:
You can paste Chris' code into .css file or between <head><style>hehe</style></head> tags.
Mine goes as it is on the website I posted link to.
 
At the top of your file:
Code:
<style type="text/css">
div.rollover {
     height: 100px;
     width: 100px;
     background: url('myImage.png') no-repeat;
}
div.rollover:hover {
     background: url('myHoverImage.png') no-repeat;
}
</style>
If its a .php file, put the code over <?php
 
Last edited:
Status
Not open for further replies.
Back
Top