PDA

View Full Version : Image Thumbnail Viewer II



isingelectric
08-14-2008, 02:44 PM
Script: Image Thumbnail Viewer II
URL: http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm

I am trying to use the Image Thumbnail Viewer II script on part of my website, located at http://plaza.ufl.edu/melanier/work/workmenu.html. The effect works in Internet Explorer, but in Firefox (my default browser), the image loads an entirely new page, instead of inside the div layer. This script works on the Dynamic Drive website and I remember seeing it working on other websites when I visit them via Firefox, but for some reason, I can't get it to work on mine, either locally or online.

Can anyone look through my code and tell me what's wrong? I've already checked the location of the .js file; it seems to be correct.

Thank you so much :]

Dirt_Diver
08-14-2008, 03:52 PM
Change this:

<script type="text/javascript" src="thumbnailviewer2.js" defer="defer">

To this:

<script type="text/javascript" src="/thumbnailviewer2.js" defer="defer">

Or this::

<script type="text/javascript" src="http://plaza.ufl.edu/melanier/work/thumbnailviewer2.js" defer="defer">

isingelectric
08-14-2008, 04:06 PM
Thanks for the suggestion. I tried it out but it still didn't work :(

jscheuer1
08-14-2008, 05:07 PM
This is very strange. The script looks fine. In fact, if I make a local copy of the page and set it up to use the script on your server, it works fine in FF. I believe that it may be your DOCTYPE, or perhaps something about the host settings. In any case, when the script gets served on the live page, it is filled with gibberish. This is something to do with the character encoding, but shouldn't be a problem for FF unless the server is doing something to the character encoding.

Try replacing:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

with:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

Also, try replacing:


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

with:


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

If one or the other or both of those don't fix it, it is probably some setting on the server.

Dirt_Diver
08-14-2008, 05:12 PM
I think it's the server because I was able to set up a test page and I am running FF and IE and I was able to use her exact code except for the modification I had mentioned above and I was able to get it to work.

jscheuer1
08-14-2008, 05:27 PM
I think it's the server because I was able to set up a test page and I am running FF and IE and I was able to use her exact code except for the modification I had mentioned above and I was able to get it to work.

That could well be. I did the same, as I noted. Unfortunately, due to the local versions working in FF, we cannot test solutions on our end. However, the suggestions I outlined may fix it regardless, so should at least be tried.

I'm a bit puzzled by the user saying that it wouldn't work for them locally in FF though.

isingelectric
08-14-2008, 08:31 PM
Thanks for trying, jscheuer1. Your additional code changes didn't seem to help either. I think I'm going to try to upload the files to my host with another transfer type; right now it's set on binary. However, that doesn't seem to explain why it won't work locally. This is all so strange, because my website is the only site that this script doesn't work on.

jscheuer1
08-15-2008, 04:32 PM
Binary is generally the way to go. Make sure you've only saved the script file in a text only editor with it's encoding set to UTF-8 or other that will not save non-standard characters most text only editors (like NotePad) are set to something like this by default.

I'm still thinking it may be something to do with your host. Try contacting them and asking if they have .js files set to be served as anything other than text/javascript or whatever the default is (possibly application/x-javascript).

You could also try, when saving in a text only editor, change the filename to:

thumbnailviewer2.txt

and reference it that way in on your page:


<script type="text/javascript" src="thumbnailviewer2.txt" defer="defer">

/***********************************************
* Image Thumbnail Viewer II script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>