English 中文(简体)
javascript mis: Object not defined
原标题:javascript error: object not defined
  • 时间:2010-11-16 18:21:34
  •  标签:
  • javascript

我试图重复我在另一个网页上工作的一些文字,但总是与这段文字发生错误。

我有一份称为日历Popup.js的文件。 它与我的超文本类似:

<script type="text/javascript" src="/administrator/components/com_arrcard/js/CalendarPopup.js"></script>

该图书馆设有一个 j式图书馆,显示用户从点击链接起可以选择一个日期。 之后,这一价值被引入一个领域。 这里是展示实地和联系的法典:

<tr id="birthDate">
<td align="left" valign="top">
    <script type="text/javascript">
    var calStart = new CalendarPopup("calendar");
    calStart.showNavigationDropdowns();
    </script>
    Birth Date:
</td>

  <td>
    <input style="width:124px;" type="text" name="birthdate" value="" />
    <a href="#" onclick="calStart.select(document.instantForm.birthdate, anchorBirthdate , MM/dd/yyyy ); return false;" id="anchorBirthdate">select</a>
  </td>
</tr>

之后,有一部分人实际上持有日历:

<div id="calendar" style="position:absolute;visibility:hidden; background-color:white; layer-background-color:white;"></div>

所有这些工作都在一页上毫无节制,但在这个新一页上,我发现错误。

CalendarPopup is not defined

内容提要

var calStart = new CalendarPopup("calendar");

我失踪了什么? 我确信,这确实是显而易见的,但我早就在醒过了,可以看到这一点。

最佳回答

Make sure the script that defines the CalendarPopup class is in a place where it is executed before any other javascript references it.

问题回答

If the source of your js file is the same as http://www.mattkruse.com/javascript/calendarpopup/source.html, then it is said in that you must include the three other js files too
AnchorPosition.js
date.js
PopupWindow.js

感谢。

你可以在窗户上添加一个活动听众,并在装满后使用档案。

//Some js file

window.addEventListener( load ,onload,false);


function onload(){

 var x = new yourObject();
}

您目前重新称呼它,然后装上,因此该物体没有界定错误。

这个问题很可能是你手法的装载令。

Place the <script> inclusion tag in the <head>, 并将予以罚款。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签