验证< script>标签 [英] Validating <script> tags

查看:88
本文介绍了验证< script>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 http://validator.w3.org


1.如果我有:

< meta http-equiv =" Content-Script-Type" content =" text / javascript">

那么为什么我需要< script type = text / javascript>无处不在???

我正在手工编写我的大部分代码,所以这是额外打字或

全局搜索并在以后替换


2.另一个问题是我的包含文件:

i通常< script src =" foo.js">< / script>

但是,验证员不喜欢这个。经过大量搜索,我发现

< script src =" foo.js" />,但是我的浏览器(IE6)不喜欢这个


我真的想让我的页面得到验证,因为我写的是在

回家,但现在我在某个地方我可以让他们上网,他们都不能正常工作

正确 - 特别是在网景中

Toni Mcintyre
http://wildprop.sasktelwebsite.net/

i''m having 2 problems with the http://validator.w3.org

1. if i have:
<meta http-equiv="Content-Script-Type" content="text/javascript">
then why do i need <script type=text/javascript> everywhere???
i''m writing most of my code by hand, so this is a lot of extra typing or
global search and replace later

2. the other problem is with my include files:
i usually <script src="foo.js"></script>
but, the validator doesn''t like this. after very much searching, i found
<script src="foo.js" />, but my browser (IE6) doesn''t like this

i''d really like to get my pages validated because what i''ve written works at
home, but now that i''m someplace i can get them online, they don''t all work
correctly - especially in Netscape
Toni Mcintyre
http://wildprop.sasktelwebsite.net/

推荐答案

Toni Mcintyre写道:
Toni Mcintyre wrote:
我有 http://validator.w3.org

1.如果我有:
< meta http-equiv =" Content-Script-Type"含量="文本/ JavaScript的">


虽然服务器可能会读取HTML文档来查找这样的标题,但我并不知道实际上有什么。您应该将服务器配置为发送

这是一个真正的HTTP标头。

那么为什么我需要< script type = text / javascript>到处???


Content-Script-Type标题适用于IIRC与内部事件相关的属性(onclick,onmouseover等)

我正在手工编写我的大部分代码,所以这是一个额外的打字
或全局搜索和以后替换


写一个宏为你的文本编辑器转换< script> to< script

type =" text / javascript">每当你输入它时。

2.另一个问题是我的包含文件:
我通常< script src =" foo.js">< / script>

除了缺乏类型attraibute之外,我不明白为什么它不喜欢它。

经过非常多的搜索,我<发现
< script src =" foo.js" />,但我的浏览器(IE6)不喜欢这个
i''m having 2 problems with the http://validator.w3.org

1. if i have:
<meta http-equiv="Content-Script-Type" content="text/javascript">
While servers may read HTML documents to look for such headers, I''m not
aware of any that actually do. You should configure your server to send
this as a real HTTP header.
then why do i need <script type=text/javascript> everywhere???
The Content-Script-Type header applies, IIRC, to those attributes relating
to intrinsic events (onclick, onmouseover and so on)
i''m writing most of my code by hand, so this is a lot of extra typing
or global search and replace later
Write a macro for your text editor to convert <script> to <script
type="text/javascript"> whenever you type it.
2. the other problem is with my include files:
i usually <script src="foo.js"></script>
but, the validator doesn''t like this.
Aside from that lack of type attraibute, I don''t see why it doesn''t like it.
after very much searching, i
found
<script src="foo.js" />, but my browser (IE6) doesn''t like this




不,IE 6还不支持XHTML。


-

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



No, IE 6 doesn''t support XHTML yet.

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


Toni Mcintyre< ed *********** @ sasktel.net>写道:
Toni Mcintyre <ed***********@sasktel.net> wrote:
我在使用 http时出现2个问题://validator.w3.org

1.如果我有:
< meta http-equiv =" Content-Script-Type"
内容= QUOT;文本/ JavaScript的">那我为什么需要< script
type = text / javascript>到处???


因为script元素需要type属性。此外,

因为该值包含斜杠,所以必须引用它。

2.另一个问题是我的包含文件:
我通常< script src =" foo.js">< / script>
但是,验证器不喜欢这个。
i''m having 2 problems with the http://validator.w3.org

1. if i have:
<meta http-equiv="Content-Script-Type"
content="text/javascript"> then why do i need <script
type=text/javascript> everywhere???
Because the type attribute is required for the script element. Also,
since the value contains a slash, it must be quoted.
2. the other problem is with my include files:
i usually <script src="foo.js"></script>
but, the validator doesn''t like this.




再次缺少必需的类型属性。


-

David H?s?



Again missing a required type attribute.

--
David H?s?ther


" Toni Mcintyre" ; < ED *********** @ sasktel.net>写道:
"Toni Mcintyre" <ed***********@sasktel.net> wrote:
我在使用 http时出现2个问题://validator.w3.org

1。如果我有:
< meta http-equiv =" Content-Script-Type" content =" text / javascript">
那么为什么我需要< script type = text / javascript>到处???


因为在您验证

的任何DTD中都需要type属性。这就是验证器所做的一切 - 他们将代码与DTD进行比较。


实际上你需要< script type =" text / javascript" ;>作为/字符

不是可以在属性值中取消引用的那个。

我正在手工编写我的大部分代码,所以这是很多额外输入或
全局搜索和以后替换


你有多少个脚本元素?

2.另一个问题是我的包含文件:
我通常< script src =" foo.js">< / script>
但是,验证器不喜欢这个。


因为它缺少类型属性?验证器提供的实际错误

消息是什么?


< script src =" foo.js"类型= QUOT;文本/ JavaScript的">< /脚本>非常好

有效。

经过大量搜索,我发现
< script src =" foo.js" />,但我的浏览器(IE6)不喜欢这个


< element />如果你的写作XHTML(是吗?)可以,但是真的可以

只推荐用于天生空的元素(hr,img,

等)。

我真的想让我的页面得到验证,因为我写的是在家里工作的,但是现在我在某个地方我可以把它们上网,他们不会所有工作都正确 - 尤其是在Netscape中
i''m having 2 problems with the http://validator.w3.org

1. if i have:
<meta http-equiv="Content-Script-Type" content="text/javascript">
then why do i need <script type=text/javascript> everywhere???
Because the type attribute is required in whatever DTD your validating
against. That''s all that validators do - they compare the code with
the DTD.

Actually you need <script type="text/javascript"> as the / character
is not one that can be unquoted in an attribute value.
i''m writing most of my code by hand, so this is a lot of extra typing or
global search and replace later
How many script elements do you have?
2. the other problem is with my include files:
i usually <script src="foo.js"></script>
but, the validator doesn''t like this.
Beacuse it''s missing the type attribute? What''s the actual error
message the validator gives?

<script src="foo.js" type="text/javascript"></script> is perfectly
valid.
after very much searching, i found
<script src="foo.js" />, but my browser (IE6) doesn''t like this
<element /> is fine if your writing XHTML (are you?) but can really
only be recommended for elements that are by nature empty (hr, img,
etc.).
i''d really like to get my pages validated because what i''ve written works at
home, but now that i''m someplace i can get them online, they don''t all work
correctly - especially in Netscape




验证页面的URL是什么?

什么您正在验证DTD吗?

您在Netscape的哪个版本中遇到了什么问题?


Steve


-

我的理论给你起见,我的异端邪说你,

我从不回信,你不喜欢我的领带。 - 医生


Steve Pugh< st *** @ pugh.net> < http://steve.pugh.net/>



What''s the URL of the pages your validating?
What DTD are you validating against?
What problems are you having in which versions of Netscape?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don''t like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>


这篇关于验证&lt; script&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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