- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
你好 friend ,我有一个带有下一个上一个按钮的日历,当用户单击下一个按钮时,下周的日程将会出现,如果用户再次单击什么都不会发生,我想显示下 1 周内的日期
我的下一个按钮的 JavaScript
function Next()
{
/*sunday*/
var next_sunday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+7));
var sunday = [next_sunday.getDate()];
var smonth = [next_sunday.getMonth() + 1] ;
var syear = [next_sunday.getFullYear()];
var sunday_date= syear + '-' + smonth + '-' + sunday;
alert(sunday_date);
document.getElementById("sunday").innerHTML =sunday;
/*monday*/
var next_monday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+1));
var monday = [next_monday.getDate()];
var mmonth = [next_monday.getMonth() + 1] ;
var myear = [next_monday.getFullYear()];
var monday_date= myear + '-' + mmonth + '-' + monday;
alert(monday_date);
document.getElementById("monday").innerHTML =monday;
/*Tuesday*/
var next_tuesday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+2));
var tuesday = [next_tuesday.getDate()];
var tmonth = [next_tuesday.getMonth() + 1] ;
var tyear = [next_tuesday.getFullYear()];
var tuesday_date= tyear + '-' + tmonth + '-' + tuesday;
alert(tuesday_date);
document.getElementById("tuesday").innerHTML =tuesday;
/*Wednesday*/
var next_wedday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+3));
var wednesday = [next_wedday.getDate()];
var wmonth = [next_wedday.getMonth() + 1] ;
var wyear = [next_wedday.getFullYear()];
var wednesday_date= wyear + '-' + wmonth + '-' + wednesday;
alert(wednesday_date);
document.getElementById("wednesday").innerHTML =wednesday;
/*Thursday*/
var next_thuday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+4));
var thursday = [next_thuday.getDate()];
var thmonth = [next_thuday.getMonth() + 1] ;
var thyear = [next_thuday.getFullYear()];
var thursday_date= thyear + '-' + thmonth + '-' + thursday;
alert(thursday_date);
document.getElementById("thursday").innerHTML =thursday;
/*friday*/
var next_friday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+5));
var friday = [next_friday.getDate()];
var fmonth = [next_friday.getMonth() + 1] ;
var fyear = [next_friday.getFullYear()];
var friday_date= fyear + '-' + fmonth + '-' + friday;
alert(friday_date);
document.getElementById("friday").innerHTML =friday;
/*saturday*/
var next_satday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+6));
var saturday = [next_satday.getDate()];
var samonth = [next_satday.getMonth() + 1] ;
var sayear = [next_satday.getFullYear()];
var saturday_date= sayear + '-' + samonth + '-' + saturday;
document.getElementById("saturday").innerHTML =saturday;
alert(saturday_date);
$("#date").datepicker("setDate", new Date(next_monday));
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var week_month = months[next_satday.getMonth()] ;
var week_year = [next_satday.getFullYear()];
document.getElementById("endDate").innerHTML =week_month +' '+ saturday + ',' + ' ' + week_year;
}
请提出一些建议
最佳答案
我得到了我使用的答案 if else 首先循环我捕获了本周的最后一个日期平均星期六日期,然后与下星期六进行比较
Javascript
function Next()
{
// get current week saturday
var textbox_value=document.getElementById("date").value;
var current_week = new Date(textbox_value);
var next_satday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+6));
var current_satday = [next_satday.getDate()];
//alert(current_satday);
// last week saturday as per my requirement
// you can modify as per your requirement
var curr = new Date;
var firstday = new Date(curr.setDate(curr.getDate() - curr.getDay()));
var lastday = new Date(curr.setDate(curr.getDate() - curr.getDay()+6));
var last_satday = [lastday.getDate()];
//alert(last_satday);
if(current_satday <= last_satday){
//alert('success');
/*sunday*/
var next_sunday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+7));
var sunday = [next_sunday.getDate()];
var smonth = [next_sunday.getMonth() + 1] ;
var syear = [next_sunday.getFullYear()];
var sunday_date= syear + '-' + smonth + '-' + sunday;
//alert(sunday_date);
document.getElementById("sunday").innerHTML =sunday;
/*monday*/
var next_monday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+1));
var monday = [next_monday.getDate()];
var mmonth = [next_monday.getMonth() + 1] ;
var myear = [next_monday.getFullYear()];
var monday_date= myear + '-' + mmonth + '-' + monday;
//alert(monday_date);
document.getElementById("monday").innerHTML =monday;
/*Tuesday*/
var next_tuesday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+2));
var tuesday = [next_tuesday.getDate()];
var tmonth = [next_tuesday.getMonth() + 1] ;
var tyear = [next_tuesday.getFullYear()];
var tuesday_date= tyear + '-' + tmonth + '-' + tuesday;
//alert(tuesday_date);
document.getElementById("tuesday").innerHTML =tuesday;
/*Wednesday*/
var next_wedday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+3));
var wednesday = [next_wedday.getDate()];
var wmonth = [next_wedday.getMonth() + 1] ;
var wyear = [next_wedday.getFullYear()];
var wednesday_date= wyear + '-' + wmonth + '-' + wednesday;
//alert(wednesday_date);
document.getElementById("wednesday").innerHTML =wednesday;
/*Thursday*/
var next_thuday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+4));
var thursday = [next_thuday.getDate()];
var thmonth = [next_thuday.getMonth() + 1] ;
var thyear = [next_thuday.getFullYear()];
var thursday_date= thyear + '-' + thmonth + '-' + thursday;
//alert(thursday_date);
document.getElementById("thursday").innerHTML =thursday;
/*friday*/
var next_friday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+5));
var friday = [next_friday.getDate()];
var fmonth = [next_friday.getMonth() + 1] ;
var fyear = [next_friday.getFullYear()];
var friday_date= fyear + '-' + fmonth + '-' + friday;
//alert(friday_date);
document.getElementById("friday").innerHTML =friday;
/*saturday*/
var next_satday = new Date(current_week.setDate(current_week.getDate() - current_week.getDay()+6));
var saturday = [next_satday.getDate()];
var samonth = [next_satday.getMonth() + 1] ;
var sayear = [next_satday.getFullYear()];
var saturday_date= sayear + '-' + samonth + '-' + saturday;
document.getElementById("saturday").innerHTML =saturday;
//alert(saturday_date);
$("#date").datepicker("setDate", new Date(next_monday));
var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
var week_month = months[next_satday.getMonth()] ;
var week_year = [next_satday.getFullYear()];
document.getElementById("endDate").innerHTML =week_month +' '+ saturday + ',' + ' ' + week_year;
}
关于javascript - 日历 : Show dates upto next 1 week from current week,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39178031/
我有一个扩展程序,我已经拆掉了裸机,它使自己处于不正确的状态,当它折叠时它会说“显示更少”。 这有两种情况 我使用“显示更多”展开扩展,然后离开屏幕。我打开另一个应用程序,然后返回到扩展程序。扩展的扩
为什么这些不相等? show $ if someCondition then someInt else some double 和 if someCondition then show someInt
下面给出的代码可以编译,ok。 data Car p q r = Car {company :: p , model :: q
是否可以在表结构中的“显示 0 到 0 个条目中的 0 个条目”旁边显示“显示条目”下拉列表。我想在底部显示“显示条目”下拉列表以及分页并显示 0 到 0 个条目,共 0 个条目。 提前致谢!!! 图
我不明白当你这样做一连串 .show() 时会发生什么。我也没有编写这段代码,也不知道如何弄清楚这里发生了什么。因此就有了这个问题。 // Remove favorite category
$(document).ready(function(){ $('html').addClass('js'); var contactForm = {
因此,在实现上一个问题的 jQuery 代码后,我注意到以下内容,每当人们添加位于显示较少/显示更多菜单中的产品时,系统会刷新页面,因为它会重新计算价格,因此也会刷新页面。但是当发生这种情况时,菜单会
我已经在 Windows 上设置了 mongodb 64bits。我成功运行了服务器和客户端。 但是当我输入时: show dbs 输出是 local 0.000GB 为什么? show dbs 应
正如标题所说,我有兴趣使用 Show a在我有 Show (a,b) 的情况下. GADT 很容易出现这个问题,如下所示: data PairOrNot a where Pair :: (b,c)
通常 julia> Base.show(io::IO, a::Int) = print(io, "xx") show (generic function with 98 methods) julia>
通常 julia> Base.show(io::IO, a::Int) = print(io, "xx") show (generic function with 98 methods) julia>
我找不到关于 Readline 选项 show-all-if-ambiguous 和 show-all-if-unmodified 之间区别的明确解释,以及是否它们影响不同的事物或相互排斥。关于这个主
我是 BeautifulSoup 的新手,我遇到了一些我不明白的问题,我认为这个问题可能尚未得到解答,但在这种情况下,我找到的答案都没有帮助我。 我需要访问 div 的内部以检索网站的词汇表条目,但是
我已经为 iOS 10 实现了新的小部件,并使用以下代码为其设置高度: @available(iOSApplicationExtension 10.0, *) func widgetActiveDis
克隆远程 git 存储库并发出 git show --show-signature 后,它说签名是好的。然后我更改了一些文件并测试了相同的命令,它仍然说签名是好的。 上面的命令到底检查了什么?验证克隆
我陷入了这个问题,而且我对 Haskell 很陌生,我试图用以下代码完成第一个欧拉问题: main = putStrLn . show . sum $ [3,6..1000]:[5,10..1000]
我有一个独立的 Android 和 iOS 应用程序。 目前正在 Android 上测试推送通知。 我已经使用以下通知键设置了我的 app.json "notification":{ "i
我所说的示例:http://jsfiddle.net/bsnxp/1/ 如果你检查源 .show().clone() display 是 inline-block (它应该是什么)并且 .clone(
我正在使用下面的 jQuery 代码来显示/隐藏网页上的额外文本 jQuery.fn.shorten = function(settings) { var config = { showC
我有一个带有 ng-show 的 div。这个 div 是我创建的自定义指令的包装器。 HTML JS function myDirective() { function doS
我是一名优秀的程序员,十分优秀!