继承日期类? [英] Inherit Date Class?

查看:56
本文介绍了继承日期类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我对javascript的更多参与工作有点新意,并且我有一些问题。

有一些问题。


我的问题是:我正在使用CMS,其中包括各种页面中的各种

javascrip文件,包括日历文件

(Dynarch)。


我想在CMS中添加一些新功能,并从另一个日历(Zapatech)添加一些额外的javascript文件。

Zapatech日历是基于Dynarch日历的veeeeeeery。


两个日历都扩展了Date对象,并且在很多地方使用相同的

原型函数名称,例如Date.prototype.getMonthDays


问题是调用Date.getMonthDays,例如,从Dynarch文件中调用

定义(这些文件包含在

页面首先),而我希望它在Zapatech

文件中调用定义。


我一直在寻找为了一种方法来应用适当的命名空间,通过

将Date类继承到一个新的类中,例如ZDate,但还没有

想出如何成功实现这一点。


例如,我在新ZDate类中的尝试将返回错误

当你尝试ZDate.parse时(2008年7月8日);声明ZDate.parse是

不是函数


所以我的问题是如何成功分离我的新javascript来自

已经存在的定义。


(或者,有没有办法删除所有添加到日期类的
,并从一个新的日期开始我的新版本

javascript?)


非常感谢任何帮助!


Chris

Hi,

I''m kind of new to the more involved workings of javascript, and am
having a few problems.

My problem is this: I am working with a CMS which is including various
javascrip files in the pages, including files for a calendar
(Dynarch).

I would like to add some new functionality to the CMS and add some
extra javascript files from a different calendar (Zapatech). The
Zapatech calendar is veeeeeeery closely based on the Dynarch calendar.

Both calendars extend the Date object, and in many places use the same
prototype function names e.g. Date.prototype.getMonthDays

The problem is that calling Date.getMonthDays, for example, calls the
definition from the Dynarch files (these files are included in the
page first), whereas I want it to call the definition in the Zapatech
files.

I have been looking for a way to apply appropriate namespacing, via
inheriting the Date class into a new class e.g. ZDate, but have not
figured out how to successfully achieve this.

For example, my attempts at the new ZDate class will return an error
when you try ZDate.parse("Jul 8, 2008"); stating that ZDate.parse is
not a function

So my question is how do I succesfully seperate my new javascript from
the already present definitions.

(or alternatively, is there a way to remove all the additions made to
the Date class, and start with a fresh Date version for my new
javascript?)

Any help in this is greatly appreciated!

Chris

推荐答案

嗨Chris

您将找到关于您需要的教程和博客文章
http://developer.yahoo.com/yui/theater/

Peter

" Chris" < ch ******************** @ googlemail.com写了留言

新闻:2a ********** ************************ @ d1g2000h sg.googlegroups.com ...
Hi Chris
You will find tutorials and blog articles on what you need at
http://developer.yahoo.com/yui/theater/
Peter
"Chris" <ch********************@googlemail.comwrote in message
news:2a**********************************@d1g2000h sg.googlegroups.com...




我对javascript更复杂的工作有点新意,而且我有一些问题。


我的问题是:我正在使用CMS,其中包括各种页面中的各种

javascrip文件,包括日历文件

(Dynarch) )。


我想在CMS中添加一些新功能,并从另一个日历(Zapatech)添加一些额外的javascript文件。

Zapatech日历是基于Dynarch日历的veeeeeeery。


两个日历都扩展了Date对象,并且在很多地方使用相同的

原型函数名称,例如Date.prototype.getMonthDays


问题是调用Date.getMonthDays,例如,从Dynarch文件中调用

定义(这些文件包含在

页面首先),而我希望它在Zapatech

文件中调用定义。


我一直在寻找为了一种方法来应用适当的命名空间,通过

将Date类继承到一个新的类中,例如ZDate,但还没有

想出如何成功实现这一点。


例如,我在新ZDate类中的尝试将返回错误

当你尝试ZDate.parse时(2008年7月8日);声明ZDate.parse是

不是函数


所以我的问题是如何成功分离我的新javascript来自

已经存在的定义。


(或者,有没有办法删除所有添加到日期类的
,并从一个新的日期开始我的新版本

javascript?)


非常感谢任何帮助!


Chris
Hi,

I''m kind of new to the more involved workings of javascript, and am
having a few problems.

My problem is this: I am working with a CMS which is including various
javascrip files in the pages, including files for a calendar
(Dynarch).

I would like to add some new functionality to the CMS and add some
extra javascript files from a different calendar (Zapatech). The
Zapatech calendar is veeeeeeery closely based on the Dynarch calendar.

Both calendars extend the Date object, and in many places use the same
prototype function names e.g. Date.prototype.getMonthDays

The problem is that calling Date.getMonthDays, for example, calls the
definition from the Dynarch files (these files are included in the
page first), whereas I want it to call the definition in the Zapatech
files.

I have been looking for a way to apply appropriate namespacing, via
inheriting the Date class into a new class e.g. ZDate, but have not
figured out how to successfully achieve this.

For example, my attempts at the new ZDate class will return an error
when you try ZDate.parse("Jul 8, 2008"); stating that ZDate.parse is
not a function

So my question is how do I succesfully seperate my new javascript from
the already present definitions.

(or alternatively, is there a way to remove all the additions made to
the Date class, and start with a fresh Date version for my new
javascript?)

Any help in this is greatly appreciated!

Chris


Peter McMurray写道:
Peter McMurray wrote:

嗨Chris

你会发现有关您需要的教程和博客文章
http:// developer。 yahoo.com/yui/theater/



Grady Booch视频很好。


一些好的报价:


Microsoft Office将有一天消耗宇宙中的所有位。


这个一:

|我在某些地方看到的错误的架构设置是你在哪里
|在这里有一个建筑群(波浪手)与

|无关任何一个项目,你最终得到的人通常是

|那些......他们在那里的人因为他们不够好而不能成为b $ b |在一个真实的项目中,我会礼貌地说。

|

|而且,他们与真正的问题脱节,

|他们正在构建一些人们不会再关心的东西了。

|


这听起来很像YUI团队的角色,Yahoo Exceptional

表现团队和Douglas Crockford。


积分:

影响项目绩效的主要因素(

成功)是复杂性

糟糕的过程增加了复杂性,一个好的过程减少了它。


但是雅虎视频控件有一个很多问题(不断弹出)

收藏夹


然后当我尝试快进时,它会带我到登录页面。

The Grady Booch video is good.

Some good quotes:

"Microsoft Office will one day consume all the bits in the universe."

And this one:
| The wrong architectural setup that I see in some places is where you
| have an architectural group over here (waves hand) not associated with
| any one project and you end up with people who are generally the
| people who are... they''re there because they aren''t good enough to be
| on a real project, I''ll politely say.
|
| And furthermore, they are so disjointed from the real problem, that
| they''re building things that nobody will care about anymore.
|

That sounds a lot like the role of the YUI team, the Yahoo Exceptional
Performance Team, and Douglas Crockford.

Points taken:
The major factor that impacts the performance of a project (its
success) is complexity
A bad process increases complexity, a good one reduces it.

But the yahoo video controls have a lot of problems (kept popping up
favorites)

Then when I try and fast forward it takes me to a login page.


Peter

" Chris" < ch ******************** @ googlemail.com写了留言

新闻:2a ********** ************************ @ d1g2000h sg.googlegroups.com ...
Peter
"Chris" <ch********************@googlemail.comwrote in message
news:2a**********************************@d1g2000h sg.googlegroups.com...

>

我对javascript的更多参与工作有点新意,并且有一些问题。

我的问题是这个:我正在使用CMS,其中包括页面中的各种
javascrip文件,包括日历文件
(Dynarch)。

我想添加一些新功能到CMS并从其他日历(Zapatech)添加一些额外的javascript文件。 Zapatech日历是基于Dynarch日历的veeeeeeery。

两个日历都扩展了Date对象,并且在许多地方使用相同的
原型函数名称,例如: Date.prototype.getMonthDays

问题是调用Date.getMonthDays,例如,从Dynarch文件中调用
定义(这些文件首先包含在
页面中) ,我希望它在Zapatech
文件中调用定义。

我一直在寻找一种方法来应用适当的命名空间,通过
继承Date类到新的上课,例如ZDate,但还没弄明白如何成功实现这一点。

例如,当你尝试ZDate.parse时,我尝试新的ZDate类会返回错误
2008年7月8日);声明ZDate.parse不是函数
>Hi,

I''m kind of new to the more involved workings of javascript, and am
having a few problems.

My problem is this: I am working with a CMS which is including various
javascrip files in the pages, including files for a calendar
(Dynarch).

I would like to add some new functionality to the CMS and add some
extra javascript files from a different calendar (Zapatech). The
Zapatech calendar is veeeeeeery closely based on the Dynarch calendar.

Both calendars extend the Date object, and in many places use the same
prototype function names e.g. Date.prototype.getMonthDays

The problem is that calling Date.getMonthDays, for example, calls the
definition from the Dynarch files (these files are included in the
page first), whereas I want it to call the definition in the Zapatech
files.

I have been looking for a way to apply appropriate namespacing, via
inheriting the Date class into a new class e.g. ZDate, but have not
figured out how to successfully achieve this.

For example, my attempts at the new ZDate class will return an error
when you try ZDate.parse("Jul 8, 2008"); stating that ZDate.parse is
not a function



您是否在它可用之前调用它?在包含

| ZDate.parse |的脚本之前加载了吗?

Did you call it before it was available? Before the script containing
|ZDate.parse| was loaded?


>所以我的问题是我如何成功地从我已经存在的定义中分离我的新javascript 。

(或者,有没有办法删除对Date类所做的所有添加,并从我的新
javascript的新日期版本开始?)<

Chris
>So my question is how do I succesfully seperate my new javascript from
the already present definitions.

(or alternatively, is there a way to remove all the additions made to
the Date class, and start with a fresh Date version for my new
javascript?)

Any help in this is greatly appreciated!

Chris


dhtml写道:
dhtml wrote:

Peter McMurray写道:
Peter McMurray wrote:


这一个:

|我在某些地方看到的错误的架构设置是你在哪里
|在这里有一个建筑群(波浪手)与

|无关任何一个项目,你最终得到的人通常是

|那些......他们在那里的人因为他们不够好而不能成为b $ b |在一个真实的项目中,我会礼貌地说。

|

|而且,他们与真正的问题脱节,

|他们正在构建一些人们不会再关心的东西了。

|


这听起来很像YUI团队的角色,Yahoo Exceptional

表现团队和道格拉斯克罗克福德。
And this one:
| The wrong architectural setup that I see in some places is where you
| have an architectural group over here (waves hand) not associated with
| any one project and you end up with people who are generally the
| people who are... they''re there because they aren''t good enough to be
| on a real project, I''ll politely say.
|
| And furthermore, they are so disjointed from the real problem, that
| they''re building things that nobody will care about anymore.
|

That sounds a lot like the role of the YUI team, the Yahoo Exceptional
Performance Team, and Douglas Crockford.



(不要诋毁他们中的任何一个,更多的是我认为的那个组织
在雅虎担任
角色。

(not to discredit any of them, more to what I see as that organizational
role at Yahoo).


这篇关于继承日期类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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