从cgi调用函数 [英] calling functions from cgi

查看:85
本文介绍了从cgi调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在这样的网络文档中加载了一组函数:

< script language =" JavaScript" type =" text / javascript"

src =" /js/foo.js"< / script>


难道我不应该能够通过这样的方式在那个

相同的文档中调用foo.js内部的函数:


< script language =" JavaScript" type =" text / javascript"> myfunction(myargs)

< / script>


即使它是从CGI脚本生成的?所有加载的javascript

文件具有相同的范围,不是吗?它不像

foo.js中的函数只能用于该文件中的其他函数吗?对吗?

If I''ve loaded a set of functions in a webdocument like this:
<script language="JavaScript" type="text/javascript"
src="/js/foo.js"</script>

Shouldn''t I be able to call a function from inside foo.js later in that
same document by doing something like this:

<script language="JavaScript" type="text/javascript">myfunction(myargs)
</script>

Even though it''s generated from a CGI script? The all loaded javascript
files have the same scope do they not? It''s not like the functions in
foo.js available only to other functions within that file? Right?

推荐答案

Tony Rice写道:
Tony Rice wrote:
如果我在这样的webdocument中加载了一组函数:

< script language =" JavaScript"类型= QUOT;文本/ JavaScript的"


语言已弃用,请将其删除。


src =" /js/foo.js"< / script>

我不能通过这样的方式在同一文件中从foo.js内部调用函数:

< script language =" ; JavaScript的" type =" text / javascript"> myfunction(myargs)
< / script>


是。

即使它是从CGI脚本生成的?所有加载的javascript


从CGI生成什么 - 脚本或HTML文档?


文件具有相同的范围它们不是吗?它不像
foo.js中的函数只能用于该文件中的其他函数吗?对吧?
If I''ve loaded a set of functions in a webdocument like this:
<script language="JavaScript" type="text/javascript"
Language is deprecated, drop it.

src="/js/foo.js"</script>

Shouldn''t I be able to call a function from inside foo.js later in that
same document by doing something like this:

<script language="JavaScript" type="text/javascript">myfunction(myargs)
</script>
Yes.
Even though it''s generated from a CGI script? The all loaded javascript
What is generated from CGI - the script or the HTML document?

files have the same scope do they not? It''s not like the functions in
foo.js available only to other functions within that file? Right?




是的。


你有错误吗?什么是错误消息?是因为

文件没有被加载,还是因为你试图在页面完全加载之前操作

中的对象?

-

Rob



Yes.

Do you get errors? What is the error message? Is the error because the
file isn''t loaded, or because you are trying to manipulate objects in
the page before it''s full loaded?
--
Rob


Tony Rice写道:
Tony Rice wrote:
如果我'已经在这样的webdocument中加载了一组函数:
< script language =" JavaScript" type =" text / javascript"
src =" /js/foo.js"< / script>


不推荐使用language属性。你好像忘记了打开脚本标签中的>



难道我不能从foo.js里面调用一个函数之后在那个
同样的文档做这样的事情:

< script language =" JavaScript" type =" text / javascript"> myfunction(myargs)
< / script>


是。

即使它是从CGI脚本生成的?


服务器如何计算发送给用户的内容是不相关的。

所有加载的javascript文件具有相同的范围,不是吗?它不像foo.js中的函数只能用于那个
文件中的其他函数吗?对吗?
If I''ve loaded a set of functions in a webdocument like this:
<script language="JavaScript" type="text/javascript"
src="/js/foo.js"</script>
The language attribute is deprecated. You seem to have forgotten the ">"
from the opening script tag.
Shouldn''t I be able to call a function from inside foo.js later in that
same document by doing something like this:

<script language="JavaScript" type="text/javascript">myfunction(myargs)
</script>
Yes.
Even though it''s generated from a CGI script?
How the server works out what to send to the user isn''t relevant.
The all loaded javascript files have the same scope do they not? It''s not
like the functions in foo.js available only to other functions within that
file? Right?




对。


-

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

首页是〜/ .bashrc的位置



Right.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


Tony Rice写道:
Tony Rice wrote:
如果我在这样的网络文档中加载了一组函数:

< script language =" JavaScript" type =" text / javascript"
src =" /js/foo.js"< / script>

我不能从foo内部调用函数.js后来在那个
同样的文件做这样的事情:


不,你需要一个>之后:src =" /js/foo.js"

Mick


< script language =" JavaScript" type =" text / javascript"> myfunction(myargs)
< / script>

即使它是从CGI脚本生成的?所有加载的javascript
文件具有相同的范围,不是吗?它不像
foo.js中的函数只能用于该文件中的其他函数吗?对吗?
If I''ve loaded a set of functions in a webdocument like this:
<script language="JavaScript" type="text/javascript"
src="/js/foo.js"</script>

Shouldn''t I be able to call a function from inside foo.js later in that
same document by doing something like this:
No, you need a ">" after: src="/js/foo.js"
Mick


<script language="JavaScript" type="text/javascript">myfunction(myargs)
</script>

Even though it''s generated from a CGI script? The all loaded javascript
files have the same scope do they not? It''s not like the functions in
foo.js available only to other functions within that file? Right?



这篇关于从cgi调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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