Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Make Image Change When Hovered W/o Flash?


4 replies to this topic

#1 PHPtech

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 66 posts

Posted 24 March 2005 - 11:31 PM

Is there a way to make images on a page change without having to use flash/ Java?

#2 whyme

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 661 posts
  • Gender:Male

Posted 24 March 2005 - 11:35 PM

java as in javascript?

#3 snlildude87

    Moderator

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,325 posts
  • Location:Mawson, Antarctica

Posted 24 March 2005 - 11:44 PM

Indeed there is, PHPtech! This is what I do on my website on the pages that I want a rollover image:

1. Create a blank file named rollover.js
2. Move rollover.js to the same folder/directory as the html file you want the rollover picture to show
3. Open rollover.js
4. Copy and paste the following code to rollover.js:
img = new Image();
img.src = "yourimage.jpg";
Replace "yourimage.jpg" with the name of your image
5. Save rollover.js
6. Open the html file/page that you want the rollover picture to be in
7. Copy and paste the following code between the <head></head> tags in the html file:
<script  type="text/javascript" language="JavaScript" src="rollover.js"></script>
8. Copy and paste the following code to your html file:
<a href="link_to_go_to_when_clicked.html" onmouseover="img.src='your_mouse_over_picture.jpg';" onmouseout="img.src='normal_picture.jpg';"><img src="normal_picture.jpg" border="0" name="img"></a>
*Replace link_to_go_to_when_clicked.html with the page to go to when your rollover image is clicked. If you don't want a link, simply remove the <a></a> tags surrounding the rollover picture.
*Replace your_mouse_over_picture.jpg with the picture you want to show when your mouse is hovering over the picture (the normal picture)
*Replace normal_picture.jpg with the picture to show when your mouse is NOT over the picture.

:)

If you need more help, PM me! :)

#4 PHPtech

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 66 posts

Posted 24 March 2005 - 11:44 PM

No, Java as in the langauge that requires this program, www.java.com, Java and Javascript are two diferent langauges...

#5 whyme

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 661 posts
  • Gender:Male

Posted 25 March 2005 - 12:12 AM

that's what i thought, as you can't do much 'html' rollovers in java. anyways, snlildudes, got a great exmaple.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users