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

javascript animated buttons:

 


alalex
Hi, I am trying to create some animated buttons for a website in javascript. I wrote this code but it gives error:
Code:

<script language="JavaScript" type="text/javascript">
<!-- //
{
   if(document.images)
   // CREATING PRESS VERSION, ALSO MOUSE OVER
   goalson = new image();
   goalson.src = "images/goals_h.gif";
   homeon = new image();
   homeon.src = "images/home_h.gif";
   abouton = new image();
   abouton.src = "images/about_h.gif";
   programson = new image();
   programson.src = "images/programs_h.gif";
   newson = new image();
   newson.src = "images/news_h.gif";
   // CREATING NORMAL VERSION
   goals = new image();
   goals.src = "images/goals.gif";
   homeb = new image();
   homeb.src = "images/homeb.gif";
   about = new image();
   about.src = "images/about.gif";
   programs = new image();
   programs.src = "images/programs.gif";
   news = new image();
   news.src = "images/news.gif";
   // UP VERSION IS PRESS VERSION
}
-->
</script>

It says undefined image, and undefined button...
Donutey
Not sure how to do it in javascript, but it would be cleaner to do it in CSS:

Code:

.navigation a:link
{ background-image: url('image.gif'); }

.navigation a:visited
{ background-image: url('visited.gif'); }

.navigation a:hover
{ background-image: url('hover.gif'); }


and then just have regular <a href=" ">s inside of <div class="navigation"> </div>
alalex
Could I make something like a backgrounbd button, and over it write the text ant it would work???
Mamsaac
well, for the mouse over, I did this one last saturday.

http://mam.frih.net/

it's not much, but it's what I can contribute to this topic <_<
LukeakaDanish
I think your problem is that Image needts to be spelt with a capital I!
alalex
Your page is cool, where are you from Mamsac?
Mamsaac
oh, thanks.

I'm from mexico... the site was just started 6 days ago and I haven't had much time to edit it and build it, but I'm sure the content it will have for the next week will be enough good to fix that.

if you like progressive metal, rock, and that kind of music, I will be uploading 2 songs per month made by a friend (they are already copyrighted, he gave me permission to upload them since I helped him with the copyright). He already has enough songs for me to be uploading 2 songs per month for the next 3 years. Nice, no?

The site is in spanish... I will make an english version since I've a considerable number of friends from the US on the NET.

and again, thanks for saying the site is cool... I'm new at making websites Smile
alalex
cool, I am from Spain, but I am living in US...
Did you program the javascript code yourself? It is really good!
alalex
I did them!!
You can click here or in the banner in my signature... It was pretty easy after all...

Thanks!! Very Happy
Mamsaac
yeah, I did that code. But it's very simple, you can learn it on almost any tutorial over the internet.
alalex
yeah, I just learned how to do that code! Is in the banner below my message! Very Happy

I like your page, it has good discussions!
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.