确定闰年,javascript [英] determine leap year, javascript

查看:54
本文介绍了确定闰年,javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个javascript,通过将年份放在文本字段中并点击提交按钮来确定一年是否是闰年。


i''这对所有这些来说还是比较新的,所以请大家帮忙,ta。

解决方案

嗨...


有一个请看以下主题:

http://www.thescripts.com /forum/thread663618.html


亲切的问候



hi .. 。


查看以下主题:

http://www.thescripts.com/forum/thread663618.html


亲切的问候



感谢gits,我在这个例子中使用你的代码,它很棒。


你能告诉我%符号的作用吗? 年%100


,旗帜是什么意思?


也可以在表格提交按钮中,你解释一下这段代码,

onclick =" leapYear(document.getElementById(''year'')。value);"


嗨......


它不是我的代码;)...只是帮助它开始工作... 3件事要提及:


1.%是模数运算符 - 看看这里


2. flag是该脚本中的一个简单变量;)并不代表任何意思......那里的海报就是这样称呼的......


3.考虑使用jsakalos在那里提供的解决方案......它比其他解决方案更短可能更好


kind问候

hi, i need a javascript that determines if a year is a leap year or not, by putting the year in a text field and hitting a submit button.

i''m fairly new to all this, so would appriciate the help, ta.

解决方案

hi ...

have a look at the following thread:

http://www.thescripts.com/forum/thread663618.html

kind regards


hi ...

have a look at the following thread:

http://www.thescripts.com/forum/thread663618.html

kind regards

thanks gits, i''m using your code in that example, which works grand.

can you tell me what the % sign does? year % 100

also, what does flag mean?

also, in the form submit button, can you explain this code,

onclick="leapYear(document.getElementById(''year''). value);"


hi ...

it''s not my code ;) ... only helped to get it to work ... 3 things to mention:

1. % is the modulus-operator - have a look here

2. flag is a simple variable in that script ;) doesn''t mean anything ... the poster there called it that way ...

3. consider to use the solution that jsakalos provided there ... it''s shorter probably better then the other solution

kind regards


这篇关于确定闰年,javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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