PDA

View Full Version : Mike's Scroller in FF



schwa97
04-17-2008, 01:26 PM
1) Script Title: Mike's DHTML scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/mikescroll.htm

3) Describe problem: The script works perfectly on IE6 en 7, but FF messes the script up.

http://www.quizlet.nl/

All content is cluttered up in the left top-corner of the screen.

What's going wrong? And how can I fix this?

Thanks a bunch for the help!!

tonyking
04-17-2008, 08:29 PM
I have used this script in the past, and have had no issues with firefox. Post the code you are using and I'll look for any errors you may have.

Also a link to the live page containing the script would be helpful in assisting with any problems you may have.

schwa97
04-17-2008, 08:32 PM
Ths script is live at http://www.quizlet.nl/

You can find the source over there.

Thanks very much for your help! (Y)

tonyking
04-17-2008, 10:00 PM
Well the first thing I see is your references to the 2 javascripts are in the BODY of your page and not the HEAD, try moving the below code:



<script language="JavaScript" src="http://www.quizlet.nl/template/javascript/dhtmllib.js"></script>
<script language="JavaScript" src="http://www.quizlet.nl/template/javascript/scroller.js"></script>


Into the head of your webpage, not the body. The code below that stays there.
If that doesn't correct the problem, (which I think it should) just post again and I'll actually look into the code itself.

schwa97
04-18-2008, 07:44 AM
Hey!

It took me a lot of testing but I found out that the following code is causing the Firefox problems:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


Do you know how that's possible? And if I can change the script so I can put the doctype declaration back in place?

tonyking
04-18-2008, 01:34 PM
I looked at your page in FF, and the script looks good. I don't think that declaring the document type as strict 1.0 should have any effect on this javascript.

If you place the statement back in the head of the document and have issues, there's some non-compliant attribute in the .css associated with the scripts container.

schwa97
04-18-2008, 01:38 PM
The script looks fine in FF now, because I managed to remove the DOCTYPE part when someone visits the page using FF.

Using google I found out that more scripts have this problem with doctype and FF.

tonyking
04-18-2008, 03:02 PM
That's good to know, I'd like to read the article as well if you have a link.

Davorian
06-03-2008, 06:53 AM
If anyone is still encountering this problem, this fix worked for me and will probably work for you:

Make the following changes to dhtmllib.js:

In the function moveLayerTo, change the following lines...



layer.style.left = x;
layer.style.top = y;


to:



layer.style.left = x + "px";
layer.style.top = y + "px";


In the function moveLayerBy, change the following lines...



layer.style.left= parseInt(layer.style.left)+dx;
layer.style.top= parseInt(layer.style.top)+dy;


to:



layer.style.left= parseInt(layer.style.left)+dx+"px";
layer.style.top= parseInt(layer.style.top)+dy+"px";


And finally, in the function clipLayer, change the following line...



layer.style.clip = 'rect(' + cliptop + ' ' + clipright + ' ' + clipbottom + ' ' + clipleft +')';


to:



layer.style.clip = 'rect(' + cliptop + 'px,' + clipright + 'px,' + clipbottom + 'px,' + clipleft +')';


I think the basic idea is that when you specify an XHTML DOCTYPE, Firefox goes into 'standards mode' (as opposed to 'quirks mode') which expects properties to be defined using a strict syntax. This code is quite old, and so it specifies some values in what I'm guessing is now deprecated syntax, which Firefox ignores (causing strange behaviour). The above changes specify the relevant property values using the proper syntax. It seems to work fine for FF2, IE6 and IE7 (should work for FF3, not sure about older versions of IE or other browsers).

This may also be the problem with some of the other scripts you referred to, especially if they are old. I hope this helps someone.

tooba
09-14-2009, 08:16 PM
at first load i am not getting error now. but after the first delay, the same error appears again.