ASP.NEt与JS文件 [英] ASP.NEt with JS Files

查看:69
本文介绍了ASP.NEt与JS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,


我有一段时间没遇到这个问题,我不知道为什么它不起作用。


如果我将脚本放在ASP页面(HTML部分),那么它工作正常,

如果我试图参考JS文件,它就不会工作。


我尝试过使用< Script src =" JavaScriptFile"

Type =" text / Javascript">< / scriptin the head,但是我没有快乐,如果

我在< scriptbrackets中包含了JavaScript,它工作正常,我有

也尝试了警报,同样的事情发生了,无论我尝试什么和

do,java只会在页面中工作,否则我得到

错误对象预期。


测试代码我一直在尝试是:


< html>

< head>

< Script src =" bin / Test。 JS" type =" text / javascript">< / script>

< / head>

< body onLoad =" testFunction();"> ;

< / body>

< / html>


和测试功能是:


函数testFunction()

{

alert(''test'');

}


感谢您的帮助。


我正在使用ASP.NET V1.1进行开发

Hey,

I''v had this problem for a while and I don''t know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert(''test'');
}

thanks for any help.

I am developing with ASP.NET V1.1

推荐答案

" Dessip"写道......
"Dessip" wrote ...

< Script src =" bin / Test.js"类型= QUOT;文本/ JavaScript的">< /脚本>
<Script src="bin/Test.js" type="text/javascript"></script>



除非您更改了权限,否则我不能完全确定您会找到IUSR_Machine名称帐户

有权访问/ bin

目录。


..Net使用单独的处理器帐户,因此可以访问它。尝试

将脚本文件移到你网站的根目录,然后

更改你的src =属性以匹配。


问候


Rob

Unless you''ve changed the permissions, I''m not entirely sure you''ll find
that the IUSR_Machine name account has permissions to access the /bin
directory.

..Net uses a separate processor account hence being able to access it. Try
moving the script file out to the root directory of your website, and then
change your src= attribute to match.

Regards

Rob


您是否尝试将其放在bin之外的目录中?我总是将我的

js放在''js''目录中,我也会尝试将路径从根目录调整为

完整路径。即:

/appfolder/js/javascriptfile.js


Dessip写道:
have you tried putting it in directory besides ''bin''? I always put my
js in a ''js'' directory, I''d also try adjusting the path to be the
complete path from the root directory. ie:
/appfolder/js/javascriptfile.js


Dessip wrote:

嘿,


我有一段时间没遇到这个问题,我不知道为什么它不起作用。


如果我将脚本放在ASP页面(HTML部分),那么它工作正常,

如果我试图参考JS文件,它就不会工作。


我尝试过使用< Script src =" JavaScriptFile"

Type =" text / Javascript">< / scriptin the head,但是我没有快乐,如果

我在< scriptbrackets中包含了JavaScript,它工作正常,我有

也尝试了警报,同样的事情发生了,无论我尝试什么和

do,java只会在页面中工作,否则我得到

错误对象预期。


测试代码我一直在尝试是:


< html>

< head>

< Script src =" bin / Test。 JS" type =" text / javascript">< / script>

< / head>

< body onLoad =" testFunction();"> ;

< / body>

< / html>


和测试功能是:


函数testFunction()

{

alert(''test'');

}


感谢您的帮助。


我正在开发ASP.NET V1.1
Hey,

I''v had this problem for a while and I don''t know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert(''test'');
}

thanks for any help.

I am developing with ASP.NET V1.1


文件是否在bin中?文件夹或根目录?

-

Eliyahu Goldin,

软件开发人员&顾问

Microsoft MVP [ASP.NET]


" Dessip" < De **** @ gmail.comwrote in message

news:11 ********************** @ m79g2000cwm.googlegr oups.com ...
Is the file in "bin" folder or in the root one?
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Dessip" <De****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...

嘿,


我有一段时间遇到这个问题,我不知道不知道为什么它不起作用。


如果我把脚本放在ASP页面(HTML部分)然后它工作正常,

如果我试图引用JS文件,它不会工作。


我尝试过使用< Script src =" JavaScriptFile"

Type =" text / Javascript" >< / scriptin the head,但我没有快乐,如果我在b< scriptbrackets中包含了JavaScript,它工作正常,我有

也试过了它有警报和同样的情况发生,无论我尝试什么和

做什么,java只会在它的页面中工作,否则我得到

错误对象预期。


我一直在尝试的测试代码是:


< html>

< head>

< Script src = "斌/ Test.js" type =" text / javascript">< / script>

< / head>

< body onLoad =" testFunction();"> ;

< / body>

< / html>


和测试功能是:


函数testFunction()

{

alert(''test'');

}


感谢您的帮助。


我正在使用ASP.NET V1.1进行开发
Hey,

I''v had this problem for a while and I don''t know why its not working.

If i place script in the ASP Page (HTML Section) then it works fine,
thou if i try to refrence a JS file, it wont work.

I have tried using <Script src="JavaScriptFile"
Type="text/Javascript"></scriptin the head, but I had no joy, thou if
I include the JavaScript in <scriptbrackets, it works fine, I have
also tried it with alert and the same happens, no matter what I try and
do, the java will only work when its in the page, otherwise I get the
error Object Expected.

The test code I have been trying is:

<html>
<head>
<Script src="bin/Test.js" type="text/javascript"></script>
</head>
<body onLoad="testFunction();">
</body>
</html>

and test function is:

function testFunction()
{
alert(''test'');
}

thanks for any help.

I am developing with ASP.NET V1.1



这篇关于ASP.NEt与JS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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