in html, a form comprises of various elements which helps in making a user interface in a web page. using which we can collect different nature of nature.
One of the commonly used control is Month control i.e.
Executing the code given above, a month control will be displayed on the page.
When you click on the calendar icon on the right side of the control, it will open the complete month calendar like this −
一旦下拉菜单打开,您可以从日历中选择月份和年份,或者您可以在控件中输入月份和年份。
Once the month and year is selected, it will get stored in String type of value.
Let us create a program to display the selected month and year from the control using JavaScript.
Example
Admission Form function display(){ d=form1.doa.value; document.write("Date of Admission is "+d +""); }
In this program, we have used tag to write JavaScript code in which a function is created to display the selected month when onchange() event is triggered. onchange event will be fired when a date value is selected from the control. document.write() will display the value on the next page. We have displayed the date of admission in the formatted output by using formatting tags.
Admission Form function display(){ d=form1.doa.value; document.write("Date of Admission is "+d +""); }
We can also set the default value of month and year which should be displayed when the web page gets loaded in the browser. To do so, we can use value attribute in tag.
Example
Select a month:
Once this program is executed, it will show “December, 1980” as the default value in the month control.
In this program, you can observe that only December month (year 1980) is active and others are disabled and similarly when you type the year 1981, it will show you months upto November because we have set the range.
If user types the invalid month or year name, it will show an error message like this −
We can also make use of step attribute using which we can skip few months for the given year while setting the date range. Look at the example shown below of an event registration form where assuming that a particular event is falling under specific months.
Example
Live Concert Olympics in Beijing World Series(Baseball)
CSS 超链接属性解析:text-decoration 和 color 超链接是网页中常用的元素之一,它能够在不同页面之间建立连接。为了使超链接在页面中有明显的标识和吸引力,CSS 提供了一些属性来调整超链接的样式。本文将重点介绍 text-decoration 和 color 这两个与超链接相关的…
每天10道题,100天后,搞定所有前端面试的高频知识点,加油!!!,在看文章的同时,希望不要直接看答案,先思考一下自己会不会,如果会,自己的答案是什么?想过之后再与答案比对,是不是会更好一点,当然如果你有比我更好的答案,欢迎评论区留言,一起探讨技术之美。 面试官:页面导入样式时,使用 link 和 …