The JS case brought to you today is to use JS to calculate the day of the week based on the date. Without further ado, let’s take a look at the example code. Friends in need can also do it themselves.
<script>function getDayOfWeek(dayValue) { var day = new Date(Date.parse(dayValue.replace(/-/g, '/'))); var today = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); //alert( today[day.getDay()]) document.getElementById("xingqiji").value =today[day.getDay()]; } document.onreadystatechange = subSomething;//当页面加载状态改变的时候执行这个方法. function subSomething() { var cObj = DATA_2; cObj.removeAttribute("readOnly"); alert("dd"); } </script>
I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
Summary of the front-end js framework and explanation of its uses
JS and servlet in h5 realize file upload Implementation steps
# Implementation steps of DOM programming in html5
The above is the detailed content of js code case - calculate the day of the week based on the date. For more information, please follow other related articles on the PHP Chinese website!