Javascript包含无法识别 [英] Javascript includes not recognised

查看:102
本文介绍了Javascript包含无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这可能看起来像客户端问题但....


我有网页组成一些javascript包括文件

以及''in page''脚本。它们在本地运行良好,直到我在IIS服务器上托管它们。然后页面拒绝看嵌套的javascript

来电。


例如


主页面包含要调用的JS代码一个包含文件的函数( -

没有probs),它反过来想要调用其他一个JS

包含文件中的一个函数,但是''对象预期''错误在

的行中调用 - 我假设因为它不能很好用。


我认为它可能与处理订单有关但是因为这些文件

几乎与我创建的另一个网站相同(当然JS

包含文件并且100%工作),我有点迷茫。任何帮助都会非常感激。


马丁

解决方案

问题可能是因为浏览器设法下载了所有包含.js文件的b $ b。相反,它试图在

a文件中调用一个它还没有的函数,产生错误。


干杯

Ken

" Martin Walke" <毫安********** @ spamvega.co.uk>在留言中写道

news:%2 ****************** @ TK2MSFTNGP10.phx.gbl ...





:这可能看起来像客户端问题但....



:我的网页由许多javascript包含的文件构成

as

:以及''in page''脚本。他们都在本地运行良好,直到我在我们的IIS服务器上托管

:它们。然后页面拒绝看嵌套的javascript

:来电。



:例如



:主页包含用于将函数调用到其中一个包含文件的JS代码

( -

:无probs),后者又要调用一个函数在另一个JS

:包含文件中,但在'b
行中出现''对象预期'错误:该调用 - 我假设因为它不能很好的功能。



:我认为它可能与处理订单有关但是作为这些文件

:几乎与我创建的另一个网站完全相同(当然JS

:包含文件并且100%工作),我有点迷茫。任何帮助都将是

:非常感谢。



:Martin







预期的对象意味着你使用的引用是正确的并且

对象没有不存在(脚本可能无法加载)或

引用不正确(例如区分大小写)。


尝试发出警报脚本onload事件,以查看在调用函数的位置发出警报之前是否弹出

。你还可以使用DOM来检查脚本加载状态,如果你给脚本一个你可以参考的id




确保你的.js文件在html的HEAD部分被引用 -

页面主体不应该加载,直到本节的所有元素都加载了

*除非*您指定可以异步加载脚本。


Chris。

" Martin Walke" <毫安********** @ spamvega.co.uk>在留言中写道

news:%2 ****************** @ TK2MSFTNGP10.phx.gbl ...




这可能看起来像客户端问题但....


我有一个由数字组成的网页javascript包含文件

以及''in page''脚本。它们在本地运行良好,直到我在IIS服务器上托管它们。然后页面拒绝看嵌套的javascript

来电。


例如


主页面包含要调用的JS代码一个包含文件的函数( -

没有probs),它反过来想要调用其他一个JS

包含文件中的一个函数,但是''对象预期''错误在

的行中调用 - 我假设因为它不能很好用。


我认为它可能与处理订单有关但是因为这些文件

几乎与我创建的另一个网站相同(当然JS

包含文件并且100%工作),我有点迷茫。任何帮助都会很高兴。


马丁



Chris Barber于2004年2月17日在

microsoft.public.inetserver.asp.general写道:

确保在HEAD中引用.js文件html的部分
- 在本节的所有元素都已加载*之前,页面正文不应该加载*除非*指定可以异步加载脚本。




或者您可以询问服务器端的帮助。


替换:


< script type = " text / javascript"

src =" /js/myjavascript.js">

< / script>

with:


< script type =" text / javascript">

<! - #include virtual =" /js/myjavascript.js" ; - >

< / script>

-

Evertjan。

荷兰。

(请更改x ES成点在我EMAILADDRESS)


Hi,

This may seem like a client side problem but....

I have web pages that are made up of a number of javascript include files as
well as ''in page'' script. They all work fine running locally until I hosted
them on our IIS server. Then the pages refuse to see nested javascript
calls.

e.g.

Main page contains JS code to call a function to one of the include files (-
no probs), which in turn wants to call a function in one of the other JS
include files but falls over with ''object expected'' error in the line of
that call - I assume because it can''t fine the function.

I think it may be something to do with processing order but as these files
are almost identical to another site that I created (certainly the JS
include files are and that worked 100%), I''m a bit lost. Any help would be
greatly appreciated.

Martin

解决方案

The problem may be caused because the browser has managed to download all
included the .js files yet. Instead, it is attempting to call a function in
a file that it doesn''t have yet, generating an error.

Cheers
Ken
"Martin Walke" <ma**********@spamvega.co.uk> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
: Hi,
:
: This may seem like a client side problem but....
:
: I have web pages that are made up of a number of javascript include files
as
: well as ''in page'' script. They all work fine running locally until I
hosted
: them on our IIS server. Then the pages refuse to see nested javascript
: calls.
:
: e.g.
:
: Main page contains JS code to call a function to one of the include files
(-
: no probs), which in turn wants to call a function in one of the other JS
: include files but falls over with ''object expected'' error in the line of
: that call - I assume because it can''t fine the function.
:
: I think it may be something to do with processing order but as these files
: are almost identical to another site that I created (certainly the JS
: include files are and that worked 100%), I''m a bit lost. Any help would be
: greatly appreciated.
:
: Martin
:
:
:


Object expected implies that the reference you used is either correct and
the object doesn''t exist (script may have failed to load) or that the
reference is incorrect (eg. case sensitivity).

Try putting an alert into the script onload event to see if this pops up
before an alert at the point at which you call the function. You can also
use the DOM to check the script load status if you give the script an id
that you can refer to.

Make sure you .js files are referenced in the HEAD section of the html - the
page body shouldn''t load until all elements of this section have loaded
*unless* you specify that a script can be loaded asynchronously.

Chris.
"Martin Walke" <ma**********@spamvega.co.uk> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi,

This may seem like a client side problem but....

I have web pages that are made up of a number of javascript include files as
well as ''in page'' script. They all work fine running locally until I hosted
them on our IIS server. Then the pages refuse to see nested javascript
calls.

e.g.

Main page contains JS code to call a function to one of the include files (-
no probs), which in turn wants to call a function in one of the other JS
include files but falls over with ''object expected'' error in the line of
that call - I assume because it can''t fine the function.

I think it may be something to do with processing order but as these files
are almost identical to another site that I created (certainly the JS
include files are and that worked 100%), I''m a bit lost. Any help would be
greatly appreciated.

Martin



Chris Barber wrote on 17 feb 2004 in
microsoft.public.inetserver.asp.general:

Make sure you .js files are referenced in the HEAD section of the html
- the page body shouldn''t load until all elements of this section have
loaded *unless* you specify that a script can be loaded
asynchronously.



Or you can ask serverside help.

replace:

<script type="text/javascript"
src ="/js/myjavascript.js">
</script>
with:

<script type="text/javascript">
<!--#include virtual ="/js/myjavascript.js"-->
</script>
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


这篇关于Javascript包含无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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