Home > Web Front-end > JS Tutorial > body text

js code case - calculate the day of the week based on the date

php中世界最好的语言
Release: 2017-12-04 13:31:02
Original
2525 people have browsed it

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, &#39;/&#39;)));                              
    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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template