只有DOCTYPE的JS错误? [英] JS Errors only with a DOCTYPE?

查看:85
本文介绍了只有DOCTYPE的JS错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在页面中使用JS弹出日历,发现每当我们从包含DOCTYPE的HTML页面调用代码时,我们都会收到各种JS

错误。

特定类型似乎并不重要。只要没有DOCTYPE那么

一切正常(IE和FF)。


我没有方便的特定脚本或错误,但我想知道是否有一些我可以寻找的一般性事物。除非DOCTYPE将浏览器推入

a更新的兼容模式,否则JS页面是否只使用了一些不被标记的方法?$ / $
TIA

We are using a JS popup calendar in our pages and find that we get various JS
errors whenever we call the code from an HTML page that includes a DOCTYPE. The
specific type doesn''t seem to matter. As long as there is no DOCTYPE then
everything works fine (IE and FF).

I don''t have the specific script or errors handy, but I was wondering if there
are some general things I can look for. Is the JS page just using some
deprecated methods that are not flagged unless a DOCTYPE pushes the browser into
a newer compatibility mode?
TIA

推荐答案

Rick Brandt写道:
Rick Brandt wrote:
我们在页面中使用JS弹出日历,发现我们得到了各种JS <每当我们从包含DOCTYPE的HTML页面调用代码时,就会出现错误。
特定类型似乎并不重要。只要没有DOCTYPE然后
一切正常(IE和FF)。

我没有特定的脚本或错误方便,但我想知道是否有
We are using a JS popup calendar in our pages and find that we get various JS
errors whenever we call the code from an HTML page that includes a DOCTYPE. The
specific type doesn''t seem to matter. As long as there is no DOCTYPE then
everything works fine (IE and FF).

I don''t have the specific script or errors handy, but I was wondering if there
are some general things I can look for. Is the JS page just using some
deprecated methods that are not flagged unless a DOCTYPE pushes the browser into
a newer compatibility mode?




尝试Firefox中的JavaScript控制台会显示错误。


DOCTYPE会在浏览器中打开兼容模式。


Ian



Try the JavaScript console in Firefox, it will show the errors.

DOCTYPE does turn on compatibility mode in the browser.

Ian


Ian写道:
Rick Brandt写道:
Rick Brandt wrote:
我们在页面中使用JS弹出日历,发现我们得到了每当我们从包含DOCTYPE的HTML页面调用代码时,各种JS错误。具体类型似乎并不重要。只要没有DOCTYPE,那么一切正常(IE和FF)。

我没有特定的脚本或错误方便,但我还是想知道如果有一些我可以寻找的一般事物。除非DOCTYPE将浏览器推入更新的兼容模式,否则
JS页面是否只使用了一些未标记的弃用方法?
We are using a JS popup calendar in our pages and find that we get
various JS errors whenever we call the code from an HTML page that
includes a DOCTYPE. The specific type doesn''t seem to matter. As
long as there is no DOCTYPE then everything works fine (IE and FF).

I don''t have the specific script or errors handy, but I was
wondering if there are some general things I can look for. Is the
JS page just using some deprecated methods that are not flagged
unless a DOCTYPE pushes the browser into a newer compatibility mode?



尝试使用JavaScript控制台Firefox,它会显示错误。

DOCTYPE会在浏览器中打开兼容模式。

Ian



Try the JavaScript console in Firefox, it will show the errors.

DOCTYPE does turn on compatibility mode in the browser.

Ian




是的,我做到了。神秘(对我而言)是它强调了当DOCTYPE不存在时,

运行得很好的陈述。大多数都与定位和

等各种元素的.top和.left等值有关。


是否有类似于HTML的验证站点和CSS?如果是这样的话我会猜测我可以通过类似的东西运行它来看看会发生什么。



Yes I have done that. The mystery (to me) is that it highlights statements that
run just fine when DOCTYPE is not there. Most have to do with positioning and
retreiving values like .top and .left of various elements.

Are there validator sites for JS similar to those for HTML and CSS? If so I
guess I can run it through something like that to see what turns up.


On 17/12/2005 22:38 ,Rick Brandt写道:
On 17/12/2005 22:38, Rick Brandt wrote:
Ian写道:


[snip]
Ian wrote:
[snip]
DOCTYPE会在浏览器中打开兼容模式。
DOCTYPE does turn on compatibility mode in the browser.




如果有任何文档类型声明会使浏览器更多

严格,虽然这确实迫使人们编写代码将以更加兼容的方式工作。


[snip]

神秘(对我来说)是它突出了当DOCTYPE不存在时运行良好的语句。大多数都与定位和
retreiving值,如.top和.left的各种元素有关。


例如:


element.style.left ='''24'';


也许[1]?所有CSS长度值(这是我们在这里处理的
)/必须/有单位,除非值为零(0):


元素。 style.left ='''24px'';

是否有类似于HTML和CSS的验证器网站?



If anything a document type declaration will make the browser more
strict, though that does force one to write code that will work in a
more compatible way.

[snip]
The mystery (to me) is that it highlights statements that run just
fine when DOCTYPE is not there. Most have to do with positioning and
retreiving values like .top and .left of various elements.
Such as:

element.style.left = ''24'';

perhaps[1]? All CSS length values (which is what we are dealing with
here) /must/ have units unless the value is zero (0):

element.style.left = ''24px'';
Are there validator sites for JS similar to those for HTML and CSS?




有linters(如JSLint - http://www.jslint.com/) ,但否则

没有。但是,如果知道什么是有效的CSS和有效的

文档树,那么这样的服务就没有必要了。


[snip]


迈克

[1]这个例子不会产生错误,但是它会被

正确忽略一个符合标准的浏览器,因为

已经给出。


-

Michael Winter

前缀在通过电子邮件回复之前[新闻]主题。



There are linters (like JSLint - http://www.jslint.com/), but otherwise
no. However, if one knows what constitutes valid CSS and a valid
document tree, then such a service shouldn''t necessary.

[snip]

Mike
[1] The example won''t generate an error, as such, but it will be
correctly ignored by a conforming browser for the reason
already given.

--
Michael Winter
Prefix subject with [News] before replying by e-mail.


这篇关于只有DOCTYPE的JS错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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