检查选择选项值而不提交表单
我允许用户选择日期来安排活动而且
似乎最好的方法是使用年份的下拉菜单,
月,日期。但是,当你选择一年
和一个月的那个月的适当日期时,我想这样做(即如果你选择了2006年2月的b $ b,则需要28天)。我可以轻松地做一个循环,如果我可以
找出用户选择的月份,但我似乎无法找到一个
方式来获得值。这个
问题有一个简单的JavaScript解决方案吗?
I am allowing a user to selected a date to schedule an event and it
seems like the best way to do this is with drop down menus for Year,
month, date. However I would like to make it so when you choose a year
and a month the appropriate days for that month show (i.e. 28 days if
you chose February 2006). I can easily do this with a loop if I can
find out what month the user has selected, but I can''t seem to find a
way to get that value. Is there a simple javascript solution to this
problem?
75 ****** @ gmail.com 写道:
我允许用户选择一个安排活动的日期和它似乎最好的方法是使用年份,月份,日期的下拉菜单。但是我想在你选择一年
和一个月的那个月的适当日期(即你选择2006年2月的28天)时这样做。如果我能够找出用户选择的月份,我可以通过循环轻松完成此操作,但我似乎无法找到获得该值的方法。是否有一个简单的JavaScript解决方案来解决这个问题?
I am allowing a user to selected a date to schedule an event and it
seems like the best way to do this is with drop down menus for Year,
month, date. However I would like to make it so when you choose a year
and a month the appropriate days for that month show (i.e. 28 days if
you chose February 2006). I can easily do this with a loop if I can
find out what month the user has selected, but I can''t seem to find a
way to get that value. Is there a simple javascript solution to this
problem?
< select name =" myMonthList"
onchange =" ; setBestDay(this.form,this.selectedIndex)">
< option value =" 0"> January< / option>
...
< / select>
< head>中的位置你有的部分:
< script type =" text / javascript">
function setBestDay(f,m){
// m对应于所选月份
// 0 - 1月11日 - 12月
//进行计算
/ /那么:
f.myDayList.selectedIndex = myCalculatedIndex;
}
< / script>
<select name="myMonthList"
onchange="setBestDay(this.form, this.selectedIndex)">
<option value="0">January</option>
...
</select>
where in the <head> section you have:
<script type="text/javascript">
function setBestDay(f,m) {
// m corresponds to the selected month
// 0 - January, 11 - December
// do your calculations
// then:
f.myDayList.selectedIndex = myCalculatedIndex;
}
</script>
75******@gmail.com 写道:
我允许用户选择日期来安排活动,它似乎是最好的方法,使用年份,
月份,日期的下拉菜单。
I am allowing a user to selected a date to schedule an event and it
seems like the best way to do this is with drop down menus for Year,
month, date.
不,它不是血腥的!我讨厌*不得不通过点击,滚动
选择3次!
有一个灵活验证的输入字段,以及
那些*必须*使用他们的鼠标。那里有很多开源的
例子。
No it bloody isn''t! I *hate* having to go through the click, scroll
select 3 times!
Have an input field with flexible validation, and a popup calendar for
those who *must* use their mouse. There are plenty of open source
examples out there.
你不想使用弹出式日历吗?
< 75 ****** @ gmail.com>在消息中写道
news:11 ********************** @ o13g2000cwo.googlegr oups.com ...
Don''t you want to use a popup calendar?
<75******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
我允许用户选择日期来安排活动,它似乎最好的方法是使用年份,
月份,日期的下拉菜单。但是我想在你选择一年
和一个月的那个月的适当日期(即你选择2006年2月的28天)时这样做。如果我能够找出用户选择的月份,我可以通过循环轻松完成此操作,但我似乎无法找到获得该值的方法。是否有一个简单的JavaScript解决方案来解决这个问题?
I am allowing a user to selected a date to schedule an event and it
seems like the best way to do this is with drop down menus for Year,
month, date. However I would like to make it so when you choose a year
and a month the appropriate days for that month show (i.e. 28 days if
you chose February 2006). I can easily do this with a loop if I can
find out what month the user has selected, but I can''t seem to find a
way to get that value. Is there a simple javascript solution to this
problem?