Welcome Guest ( Log In | Register)



2 Pages V  < 1 2  
Reply to this topicStart new topic
> How To: Change An Image When A User Clicks On It, using both php and javascript
electriic ink
post Jul 28 2005, 06:30 AM
Post #11


Incest is a game the whole family can play.
Group Icon

Group: [MODERATOR]
Posts: 1,223
Joined: 11-February 05
From: Heaven
Member No.: 3,709



QUOTE(sachavdk @ Jul 25 2005, 07:10 PM)
Why making it this difficult?

Simply:
CODE
<img src="img.jpg" onMouseOver="this.src='img2.jpg'" onMouseOut="this.src='img.jpg'">

I think thats way easier
*



OK, so what happens when your images aren't found? Does a nice, red cross come up in ie or does the script abort itselft altogether? This script gives you an error message displaying exactly which files cannot be found so you can easily fix the problem, which becomes more and more useful as you add more and more images for the script to change.

You don't even have to understand the coding in this script in order to adjust it for your site, just change the first 6 variables at the beginning and copy and paste it and it works.
Go to the top of the page
 
+Quote Post
mizako
post Jul 28 2005, 11:39 AM
Post #12


Super Member
*********

Group: Members
Posts: 372
Joined: 16-August 04
From: Spain
Member No.: 824



QUOTE(cmatcmextra @ Jul 21 2005, 07:07 PM)
Wait for a few seconds give your browser time to load the image. The change onMouseDown is immediate, the loading isn't.


Preloading the images with javascript will solve this issue. Just point your html page to a javascript page where the images are preloaded. once the user clicks the image will change inmediately. http://users.kaski-net.net/~erasmus/
Check the navigation bar of the previous site. It is done with preloading.
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. A Little Introduction To 3d Studio Max(9)
  2. Image Preloader With Progress Bar Status(23)
  3. Simple Login In Visual Basic 6(6)
  4. Css And Javascript Combined For Dynamic Layout(9)
  5. Image Rollovers In Javascript(11)
  6. Hiding User Account On Xp(0)
  7. How To Stop Image Hot Linking(17)
  8. How To "lock Down" A Os X User Account(1)
  9. Handy Javascript Code Snips(5)
  10. Tool Tips Using Only Css To Pop Up The Tool Tip(8)
  11. Creating A Simple Image Viewer(4)
  12. Image Shack Mod(2)
  13. Javascript Framework - A Shortcut Javascript(3)
  14. How To Make Image To Highlight When It`s Mouseovered(8)
  15. Image Gallery Tutorial Using Hoverbox(14)
  1. Simple Scripts In Html And Javascript(7)
  2. A Simple Php Captcha - Image Validation(21)
  3. Math Captcha Image Validation(1)
  4. Simple User System(19)
  5. Javascript Scroll Bar(13)
  6. Mootools - My Favourite Javascript Library(3)
  7. Image Rotator Script (another One)(0)
  8. Background Image Swap Script(15)
  9. Create A Simple Html Editor With Php And Javascript(3)
  10. User Permission Function [php](3)
  11. Simple Javascript And Password System(9)
  12. Make A Moderately-secure Password System Using Javascript(4)
  13. Lesser Known Useful Javascript Features(2)


 



- Lo-Fi Version Time is now: 12th October 2008 - 06:34 PM