Javascript

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentJavascript

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old December 2nd, 2011, 03:23 AM
Repatilian Repatilian is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 2 Repatilian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 56 sec
Reputation Power: 0
Adding CSS rollover button to javascript code

Hi, how do you add a CSS rollover button to my javascript code? My site delays the page from loading until the intro animation finishes. The rollover button is specified as id myrollover1. The rollover filenames are profile.gif and profileover.gif. I have tried to add the filenames to the preload part of the javascript but didn't work.



My code is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">

<title>Creation Index</title>

<script type="text/javascript">

var preloads=[];
function preload(){
for(var c=0;c< arguments.length;c++) {
preloads[preloads.length]=new Image();
preloads[preloads.length-1].src=arguments[c];
}
}
preload('logospining.gif','backgroundgreen.gif','l ineback.gif','lettering.gif','alien.gif','equalize r.gif','buttonbar.gif');

function init(){

var delay=4950;

setTimeout(
function(){
document.getElementById('backgroundgreen').classNa me='';
document.getElementById('lineback').className='';
document.getElementById('lettering').className='';
document.getElementById('alien').className='';
document.getElementById('equalizer').className='';
document.getElementById('buttonbar').className='';

},delay
);
}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
</script>


<style type="text/css">
html,body {
margin:0;
background-color:#000;
}
#images img {
width:100%;
}
#images #lettering,#images #lettering1 {
width:80%; /* adjust this value to suit your requirements */
left:10%; /* this value=(100%-width value)/2 */
}
#images #alien,#images #alien1 {
width:12.8%; /* adjust this value to suit your requirements */
left:50%; /* this value=(100%-width value)/2 */
}
#images #equalizer,#images #equalizer1 {
width:60%; /* adjust this value to suit your requirements */
left:21%; /* this value=(100%-width value)/2 */
}
#images img {
position: absolute;
top: 0;
left: 0;
}
.hide {
display:none;
}
#myRollover1 {
background-image:url(profile.gif);
width:151px;
height:151px;
display:block;

}
#myRollover1:hover {
background-image:url(profileover.gif);
}
</style>
</head>
<body>

<div id="images">
<img id="backgroundgreen" class="hide" style="height:100%" src="backgroundgreen.gif" alt="">
<img style="height:100%" src="logospining.gif" alt="">
<img id="lineback" class="hide" style="height:100%" src="lineback.gif" alt="">
<img id="lettering" class="hide" style="height:100%" src="lettering.gif" alt="">
<img id="alien" class="hide" style="height:100%" src="alien.gif" alt="">
<img id="equalizer" class="hide" style="height:100%" src="equalizer.gif" alt="">
<img id="buttonbar" class="hide" style="height:100%" src="buttonbar.gif" alt="">

<noscript>
<div>
<img id="backgroundgreen1" style="height:100%" src="backgroundgreen.gif" alt="">
<img id="lineback1" style="height:100%" src="lineback.gif" alt="">
<img id="lettering1" style="height:100%" src="lettering.gif" alt="">
<img id="alien1" style="height:100%" src="alien.gif" alt="">
<img id="equalizer1" style="height:100%" src="equalizer.gif" alt="">
<img id="buttonbar1" style="height:100%" src="buttonbar.gif" alt="">

</div>
</noscript>
</div>
<a href="index.html" id="myRollover1">
</a>
</body>
</html>





thank you

Reply With Quote
  #2  
Old December 4th, 2011, 05:29 AM
Repatilian Repatilian is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 2 Repatilian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 56 sec
Reputation Power: 0
i got it fixed i added this code:






<a href="index.html"
><img src="profile.gif" class="hide" border="0"
onmouseover="this.src='profileani.gif';" onmouseout="this.src='profile.gif';"
></a>




and added an id.

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentJavascript > Adding CSS rollover button to javascript code


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap