如何在Asp.Net页面中包含Javascript文件 [英] How to include Javascript file in Asp.Net page
问题描述
我想在ASP.NET页面中使用JavaScript进行一些客户端验证.
I want to do some client side validation using javascript in ASP.NET page.
我尝试使用
<script src="../../../JS/Registration.js" language="javascript" type="text/javascript" />
<script src="../../../JS/Registration.js" language="javascript" type="text/javascript" />
,但不起作用. 请帮忙.
but its not working. Please help.
推荐答案
可能该文件不在指定的路径中. "../../../"将向上移动3步到页面所在的目录,并在名为JS的文件夹中查找js文件.
Probably the file is not in the path specified. '../../../' will move 3 step up to the directory in which the page is located and look for the js file in a folder named JS.
语言 属性也已弃用.
Also the language attribute is Deprecated.
请参见脚本:
18.2.1脚本元素
18.2.1 The SCRIPT element
language
= cdata [CI]
已弃用. 内容的脚本语言 这个元素.它的值是 语言的标识符,但由于 这些标识符不是标准的 此属性已已弃用 偏爱类型.
Deprecated. This attribute specifies the scripting language of the contents of this element. Its value is an identifier for the language, but since these identifiers are not standard, this attribute has been deprecated in favor of type.
编辑
Edit
尝试更改
<script src="../../../JS/Registration.js" language="javascript" type="text/javascript" />
到
<script src="../../../JS/Registration.js" language="javascript" type="text/javascript"></script>
这篇关于如何在Asp.Net页面中包含Javascript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!