why is code not working?

  • 1
  • Question
  • Updated 9 years ago
  • Answered
Anybody have any idea why code that works for one thing does not work for the next--I have made an image button that on mouseover changes to another image. The first one for the "home" button works great. I wanted to add another --exact same thing except with two different images for "pictures" button. The code is the same except for the two images but it just doesn't work. Any ideas why? Also, sometimes the mouseover on the home one works and sometimes it doesn't.
Photo of eiwstar

eiwstar

  • 21 Posts
  • 0 Reply Likes
  • frustrated

Posted 9 years ago

  • 1
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hi eiwstar

Can you post your code? This will help us to see what's going on. Please put your code between <!-- and --> These help the code from being read on the forum.
Photo of eiwstar

eiwstar

  • 21 Posts
  • 0 Reply Likes
<!--<SCRIPT LANGUAGE="JavaScript"> Begin loadImage1 = new Image(); loadImage1.src = "http://thewolfbrothers.yolasite.com/r...; staticImage1 = new Image(); staticImage1.src = "http://thewolfbrothers.yolasite.com/r...; loadImage2 = new Image(); loadImage2.src = "http://thewolfbrothers.yolasite.com/r...; staticImage2 = new Image(); staticImage2.src = "http://thewolfbrothers.yolasite.com/r...; loadImage3 = new Image(); loadImage3.src = "http://thewolfbrothers.yolasite.com/r...; staticImage3 = new Image(); staticImage3.src = "http://thewolfbrothers.yolasite.com/r...; // End </script> <a href="http://thewolfbrothers.yolasite.com" onmouseover="image1.src=loadImage1.src;" onmouseout="image1.src=staticImage1.src;"> <img name="image1" src="http://thewolfbrothers.yolasite.com/r..." border=0></a> <a href="http://www.thewolfbrothers.yolasite.c..." onmouseover="image2.src=loadImage2.src;" onmouseout="image2.src=staticImage2.src;"> <img name="image2" src="http://thewolfbrothers.yolasite.com/r..." border=0></a> <a href="http://thewolfbrothers.yolasite.com/m..." onmouseover="image3.src=loadImage3.src;" onmouseout="image3.src=staticImage3.src;"> <img name="image3" src="http://thewolfbrothers.yolasite.com/r..." border=0></a> -->
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Would you mind sharing where you got this code from. It helps to see the source to determine if there is something missing by accident.
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Also.. the file names are case sensitive. Please make sure that you've inputted the proper case letters (capitals or lowercase).
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
I've got to go to bed.. but I would be happy to continue this tomorrow. I've found success using this image rollover generator: http://javascript.internet.com/genera...

Make sure that you paste the "head" code into one HTML widget box. Then drag another HTML box and paste in the "body" code.
Photo of eiwstar

eiwstar

  • 21 Posts
  • 0 Reply Likes
I got it from html basix. let me try putting it in separate boxes. I didn't think of that thanks! I'll let you know if it works.
Photo of eiwstar

eiwstar

  • 21 Posts
  • 0 Reply Likes
Tried it but still only the "home" button shows up. I checked and double checked all file names etc. but I can't see what the problem is.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
Hi eiwstar.

The code looks fine but the URL's of the images 2 and 3 do not exsist, which simply means they are not in that location.
These are the image URL's your using
http://thewolfbrothers.yolasite.com/r...
http://thewolfbrothers.yolasite.com/r...

You must have made a mistake with the filename or the folder they are in.

Go to your filemanager and confirm that these 2 files are in the main first folder. tigerpics.gif & tigervideo.gif
Photo of Kershnee

Kershnee

  • 2087 Posts
  • 152 Reply Likes
Hi Eiwstar - please let us know if Lee's solution worked for you. If not - then we will troubleshoot further for you.
Photo of eiwstar

eiwstar

  • 21 Posts
  • 0 Reply Likes
Hello all,

Success! I had not updated my site after adding those images to the file manager. I updated and they showed up! Thanks for all the help. I really appreciate it. It still seems to me that the images still should have showed in the editor and preview? Is this a bug?

Thanks again
Photo of lambofgod

lambofgod

  • 875 Posts
  • 35 Reply Likes
Think of it this way. When you make a new page, it doesn't show up on your site until you publish it. Even if you type it into the address bar. Same applies to an image (or any other media). If you upload a picture, but your site hasn't been updated, the picture basically doesn't exist on your site yet. I have had lots of coding with pictures, it's fun.