Can anyone tell me why these rollovers aren't working?

iPenguin

Hey, Look!
Hi,
Alright, So I'm making a website using Photoshop and ImageReady (both version 7) (I also use Dreamweaver MX to format the page after ImageReady generates the HTML. I don't know if that might cause problems...) that uses a lot of rollover images, and in all my tests before putting my site online the rollovers seem to work fine. Once I put it up on the server though, none of the rollovers seem to work...
I'm really pretty much a novice at coding, but when I looked through the code, I found something telling the browser to preload the image states, but as far as I can tell the browsers aren't...

If anyone could take a look at my site and tell if they find out what's going wrong, and how to fix it (if it is fixable...) that would be great.
My url is:
http://free.hostdepartment.com/p/pascald/
On the main index page, the ENTER HERE text is supposed to be a rollover, but in my tests it hasn't worked.

HELP!
-iPenguin
 
Probably because you commented out your JS for the rollovers...delete what's in red below.

Code:
<SCRIPT TYPE="text/javascript">[color=red]
<!--[/color]function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}}function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];		}
	}}var preloadFlag = false;function preloadImages() {
	if (document.images) {
		index__ENTER_HERE__over = newImage("images/index_-ENTER-HERE--over.gif");
		index__ENTER_HERE__down = newImage("images/index_-ENTER-HERE--down.gif");
		index_52_index__ENTER_HERE__over = newImage("images/index_52-index_-ENTER-HERE-.gif");
		index_54_index__ENTER_HERE__over = newImage("images/index_54-index_-ENTER-HERE-.gif");
		preloadFlag = true;	}}[color=red]// -->[/color]
</SCRIPT>
 
Thank you! That's what was doing it.
Funny... I've got absolutely no idea how that got there... :confused:

Thanks Again!
-iPenguin
 
Dreamweaver doesn't like code from ImageReady...past experiences of mine and others I know has shown it to do some really funky stuff, so it wouldn't surprise me at all if that's where it came from.

That's why I'm glad I gave up on JS and the old ways, embracing XHTML/CSS. Life's so much more simpler now and the majority of time isn't spent trying to fix images and scripts. Also a lot easier for others to examine and update too.

Speaking of which, next time before saving the final version try running the "Apply Source Formatting" command from the "Commands" menu in DW. Not a perfect fix, but it does the job ok. Plus having everything nicely formatted makes updating and debugging so much easier. <G>
 
iPenguin said:
I've got absolutely no idea how that got there... :confused:
Well, those tags are a left over from the early days of javascript. They are commonly referred to as "cloaking". This allows browsers that do not support javascript to ignore the code, because they think the code is an html comment. Dreamweaver most likely put them in order to maintain compatability.

If you moved the "<!--" and "//-->" parts to their own lines, I think you would have no problems with the script. But with the browsers that require cloaking only having less than 0.1% of the market, whether you leave them in or take them out is completely up to you.
 
Yep - I agree.

The fact those extra bits were there wasn't the problem - just the location of them. I still add comments around JavaScript blocks, just make sure the comments are on their own lines.

This is extra important if you have the script in the body portion of the page (rather than the head). Some search indexing robots will try to read the JavaScript as HTML with unwanted results. The commenting avoids this.
 
Back
Top