Firefox:正确的xhtml DOCTYPE标签打破脚本? [英] Firefox: correct xhtml DOCTYPE tag breaks script?

查看:58
本文介绍了Firefox:正确的xhtml DOCTYPE标签打破脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计,


我在dhtml中创建了一个动画图库。它在Internet Explorer中运行良好。
Internet Explorer。在Firefox中,它只有在我省略DOCTYPE标签时才有效。

该页面有效xhtml-strict但是使用xhtml1-strict DOCTYPE,我得到一个

死脚本和许多错误消息,例如解析

属性''宽度''中的值时出错。声明被撤销。第0行。


此页面在Firefox中无效但有效xhtml:
http://schorpioen.demon.nl/test/gallery.html


此页面有效在Firefox中,但没有文档类型,因此无法验证:
http://schorpioen.demon.nl/test/gallery_no_doctype.html


发生了什么事?


谢谢任何见解,


Lennart

Hi folks,

I have created an animated image gallery in dhtml. It works fine in
Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag.
The page is valid xhtml-strict but with a xhtml1-strict DOCTYPE, I get a
dead script and dozens of error messages like "Error in parsing value in
property ''width''. Declaration dropped." on Line 0.

This page doesn''t work in Firefox but is valid xhtml:
http://schorpioen.demon.nl/test/gallery.html

This page works in Firefox but has no document type so doesn''t validate:
http://schorpioen.demon.nl/test/gallery_no_doctype.html

What''s happening?

Thanks for any insights,

Lennart

推荐答案

Lennart写道:
Lennart wrote:

我在dhtml中创建了一个动画图库。它在Internet Explorer中运行良好。
Internet Explorer。在Firefox中,它只有在我省略DOCTYPE标签时才有效。

该页面有效xhtml-strict但是使用xhtml1-strict DOCTYPE,我得到一个

死脚本和许多错误消息,例如解析

属性''宽度''中的值时出错。声明被撤销。在第0行。
I have created an animated image gallery in dhtml. It works fine in
Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag.
The page is valid xhtml-strict but with a xhtml1-strict DOCTYPE, I get a
dead script and dozens of error messages like "Error in parsing value in
property ''width''. Declaration dropped." on Line 0.



许多浏览器查看Doctype并使用它来判断你有多聪明。如果他们认为你很聪明,那么他们就不那么宽容了CSS中的

错误。

A number of browsers look at the Doctype and use it to judge how smart you
are. If they think you are smart they are less forgiving when it comes to
errors in CSS.


这个页面不起作用Firefox但有效xhtml:
http://schorpioen.demon。 nl / test / gallery.html



p.style.width = parseInt(p.style.width)+ parseInt(ps tyle.width)* zoomfactor * p。前缀;


因此,您要分配宽度属性一个整数,乘以一个

整数,乘以缩放系数,乘以1或-1


....但在CSS非零长度需要单位。


宽度:50;不接受。


-

David Dorward< http://blog.dorward.me.uk/< http:// dorward。 me.uk/>

Home是〜/ .bashrc的地方

p.style.width=parseInt(p.style.width)+parseInt(p.s tyle.width)*zoomfactor*p.prefix;

So you are assigning to the width property "An integer, multiplied by an
interger, multiplied by the zoom factor, multiplied by either 1 or -1"

.... but in CSS non-zero lengths require units.

width: 50; is not acceptable.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is


On 02/08/2006 22:38,Lennart写道:
On 02/08/2006 22:38, Lennart wrote:

我在dhtml中创建了一个动画图库。它在Internet Explorer中运行良好。
Internet Explorer。在Firefox中,它只有在我省略DOCTYPE标签时才有效。

该页面有效xhtml-strict但是使用xhtml1-strict DOCTYPE,我得到一个

死脚本和许多错误消息,例如解析

属性''宽度''中的值时出错。声明被撤销。第0行。
I have created an animated image gallery in dhtml. It works fine in
Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag.
The page is valid xhtml-strict but with a xhtml1-strict DOCTYPE, I get a
dead script and dozens of error messages like "Error in parsing value in
property ''width''. Declaration dropped." on Line 0.



您的CSS声明无效;你省略了单位,对于非零长度值总是需要

Your CSS declarations are invalid; you''re omitting units, which are
always required for non-zero length values.


这个页面不起作用Firefox但有效xhtml:
http://schorpioen.demon。 nl / test / gallery.html



您还在调用parseInt而未指定显式基数,

通常不是一个好主意。我的考试没有进一步延伸

比这更好。


[snip]


Mike

You''re also calling parseInt without specifying an explicit radix, which
isn''t typically a good idea. My examination didn''t stretch much further
than that.

[snip]

Mike




Lennart写道:

Lennart wrote:

我在dhtml中创建了一个动画图库。它在Internet Explorer中运行良好。
Internet Explorer。在Firefox中,它只有在我省略DOCTYPE标签时才有效。

该页面有效xhtml-strict但是使用xhtml1-strict DOCTYPE,我得到一个

死脚本和许多错误消息,例如解析

属性''宽度''中的值时出错。声明被撤销。第0行。


此页面在Firefox中无效但有效xhtml:
http://schorpioen.demon.nl/test/gallery.html


此页面有效在Firefox中,但没有文档类型,因此无法验证:
http://schorpioen.demon.nl/test/gallery_no_doctype.html



当您使用
$ b $时,最近的Mozilla系列浏览器变得更加严格b无论是xhtml 1.0严格还是html 4.01严格。我发现,当页面转换为html 4.01

strict时,你的页面上的dhtml将无效。顺便说一下,你的页面将按照Opera上的编写方式工作。如果您将
转换为html 4.01过渡页面,Mozilla系列浏览器将变得更加宽松,页面上的html将在W3C验证

并开发最新版本的IE6,Opera,Firefox,Netscape和

Mozilla。请参阅 http://www.cwdjr.info/dhtml/dhtmlPost.html


所以最简单的方法就是使用html 4.01过渡。我已经看到

最近的Mozilla家庭浏览器对旧版dhtml页面的回复多次。在某些情况下,我发现数学用于计算某些屏幕位置(以像素为单位)。如果使用

Math.round()来舍入所需x或y位置的数值

,则可以计算小数像素位置。 IE6和

Opera经常不介意这一点。然而,通常

的分数像素位置可以完全消除最近Mozilla系列浏览器的dhtml效果。

所以,如果你坚持使用严格的html或严格的xhtml代码,那么首先

首先仔细检查你的脚本中使用的几个计算中是否有任何一个可以产生小数像素屏幕位置,并使用

Math。圆()或其他任何可能需要摆脱分数。

当然问题可能是别的。很多东西都可以杀死一个

dhtml脚本。

The recent Mozilla family browsers become much more strict when you use
either xhtml 1.0 strict or html 4.01 strict. I find that the dhtml on
your page will not work either when the page is converted to html 4.01
strict. By the way, your page will work as written on Opera. If you
convert your page to html 4.01 transitional, Mozilla family browsers
become more loose and the html on your page will then validate at W3C
and work on recent versions of IE6, Opera, Firefox, Netscape, and
Mozilla. See http://www.cwdjr.info/dhtml/dhtmlPost.html .

So the easy way out is to just use html 4.01 transitional. I have seen
this same response by recent Mozilla family browsers many times for
older dhtml pages. In several cases, I have found that math is being
used to calculate some screen positions in pixels. If the numerical
result for the desired x or y position is not rounded using
Math.round(), a fractional pixel position may be calculated. IE6 and
Opera often do not mind this. However a fractional pixel position often
can completely kill the dhtml effect on recent Mozilla family browsers.
So, if you insist on code in strict html or strict xhtml, then first
start by carefully examining if any of the several calculations used in
your script can result in fractional pixel screen positions, and use
Math.round() or whatever else it may take to get rid of the fractions.
Of course the problem could be something else. Many things can kill a
dhtml script.


这篇关于Firefox:正确的xhtml DOCTYPE标签打破脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆