English 中文(简体)
javascript mis{[native Code]}
原标题:javascript error { [native code] }
  • 时间:2012-01-13 19:29:08
  •  标签:
  • javascript

我不想说:

<script type="text/javascript">
var today = new Date();
document.write(today  + "<br />");
//document.write(today.length  + "<br />"); - was getting "undefined"
//document.write(today[0]  + "<br />"); - was getting "undefined"

document.write(today.getMonth  + "<br />");
document.write(today.getMonth  + "<br />");
document.write(today.getFullYear  + "<br />");

</script> 

产出:

Fri Jan 13 14:13:01 EST 2012
function getMonth() { [native code] } 
function getDay() { [native code] } 
function getFullYear() { [native code] } 

我想要的是现在的月、日、年,把它变成一个我稍后能够呼吁的阵列。 我不会因为这一本土法典而变得遥远。 谁能告诉我,现在和希望,更重要的是,我能够完成这一项目? 感谢你的时间和帮助!

最佳回答

http://www.ohchr.org。 但是,如果你使用括号执行,你会取得实际结果。

Your code should be:

document.write(today.getMonth()  + "<br />");
document.write(today.getMonth()  + "<br />");
document.write(today.getFullYear()  + "<br />");
问题回答

You are missing the parenthesis().

document.write(today.getMonth()  + "<br />");
document.write(today.getMonth()  + "<br />");
document.write(today.getFullYear()  + "<br />");
document.write(today.getMonth()  + "<br />"); // notice the () s to invoke the function
document.write(today.getMonth()  + "<br />");
document.write(today.getFullYear()  + "<br />");

。 注:

document.write(today.getMonth()  + "<br />");
document.write(today.getMonth()  + "<br />");
document.write(today.getFullYear()  + "<br />");

如你所知,它印刷了职能代表,而不是职能价值。





相关问题
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.

热门标签