项目代码:基金行事历JQuery代码
来源:互联网 发布:婴儿床上装饰 知乎 编辑:程序博客网 时间:2024/05/01 09:10
$(document).ready(function() {
//綁定年月
var date = new Date();
$("#spnYear").html(date.getFullYear());
$("#spnYear2").html(date.getFullYear());
$("#spnMonth2").html(date.getMonth() + 1);
//上一年
$("#PrevYear").click(function() {
$("#spnYear").html(parseInt($("#spnYear").html()) - 1);
setCurrentMonth();
});
//下一年
$("#NextYear").click(function() {
$("#spnYear").html(parseInt($("#spnYear").html()) + 1);
setCurrentMonth();
});
//左上角小日曆
$("div.scalendar > table > tbody > tr > td").click(function() {
$("#spnMonth2").html($(this).html().replace("月", ""));
$("#spnYear2").html($("#spnYear").html());
getCalendar();
});
//上一月
$("#PrevMonth2").click(function() {
var month = parseInt($("#spnMonth2").html());
if (month > 1) {
$("#spnMonth2").html(month - 1);
}
else {
$("#spnMonth2").html(12);
$("#spnYear2").html(parseInt($("#spnYear2").html()) - 1);
$("#spnYear").html($("#spnYear2").html());
}
getCalendar();
setCurrentMonth();
});
//下一月
$("#NextMonth2").click(function() {
var month = parseInt($("#spnMonth2").html());
if (month < 12) {
$("#spnMonth2").html(month + 1);
}
else {
$("#spnMonth2").html(1);
$("#spnYear2").html(parseInt($("#spnYear2").html()) + 1);
$("#spnYear").html($("#spnYear2").html());
}
getCalendar();
setCurrentMonth();
});
//綁定基金公司下拉框選項
$.ajax({
type: 'post',
url: 'GetData/GetFundCompanyOptionList.aspx',
dataType: "text",
data: { 'selectedValue': '' },
cache: false,
success: function(options) {
$('#sctFundCompany').append(options);
$('#sctFundCompany').change();
}
});
//綁定基金下拉框選項
$("#sctFundCompany").change(function() {
$.ajax({
type: 'post',
url: 'GetData/GetFundOptionList.aspx',
dataType: "text",
data: { 'selectedValue': '', 'fundCompany': $("#sctFundCompany").val() },
cache: false,
success: function(options) {
$('#sctFund').empty();
$('#sctFund').append(options);
},
complete: function(XMLHttpRequest, textStatus) {
//getCalendar();
}
});
});
//綁定搜尋按鈕
$('#btnSearch').click(function() {
getCalendar();
});
//頁面加載時顯示行事歷
getCalendar();
//選中當前月份
setCurrentMonth();
});
//獲取行事歷
function getCalendar() {
$.ajax({
type: 'post',
url: 'GetData/GetCalendar.aspx',
dataType: "text",
data: { 'calendarType': $('#sctCalendarType').val(), 'fundCompany': $('#sctFundCompany').val(), 'fund': $('#sctFund').val(), 'year': $('#spnYear2').html(), 'month': $('#spnMonth2').html() },
cache: false,
success: function(html) {
//alert(html);
$('#calendar_container').html(html);
}
});
}
//選中當前月份
function setCurrentMonth() {
var date = new Date();
var year = $("#spnYear").html();
var months = $("div.scalendar > table > tbody > tr > td");
$.each(months, function(i, n) {
if (year == date.getFullYear() && months[i].innerHTML == date.getMonth() + "月") {
months[i].className = "current";
} else {
months[i].className = "";
}
});
}
相关上面的代码还有一点小疑问:
$.each(months, function(i, n) {
if (year == date.getFullYear() && months[i].innerHTML == date.getMonth() + "月") {
months[i].className = "current";
} else {
months[i].className = "";
}
});
红色的部分如何使用JQuery代码替代?
//綁定年月
var date = new Date();
$("#spnYear").html(date.getFullYear());
$("#spnYear2").html(date.getFullYear());
$("#spnMonth2").html(date.getMonth() + 1);
//上一年
$("#PrevYear").click(function() {
$("#spnYear").html(parseInt($("#spnYear").html()) - 1);
setCurrentMonth();
});
//下一年
$("#NextYear").click(function() {
$("#spnYear").html(parseInt($("#spnYear").html()) + 1);
setCurrentMonth();
});
//左上角小日曆
$("div.scalendar > table > tbody > tr > td").click(function() {
$("#spnMonth2").html($(this).html().replace("月", ""));
$("#spnYear2").html($("#spnYear").html());
getCalendar();
});
//上一月
$("#PrevMonth2").click(function() {
var month = parseInt($("#spnMonth2").html());
if (month > 1) {
$("#spnMonth2").html(month - 1);
}
else {
$("#spnMonth2").html(12);
$("#spnYear2").html(parseInt($("#spnYear2").html()) - 1);
$("#spnYear").html($("#spnYear2").html());
}
getCalendar();
setCurrentMonth();
});
//下一月
$("#NextMonth2").click(function() {
var month = parseInt($("#spnMonth2").html());
if (month < 12) {
$("#spnMonth2").html(month + 1);
}
else {
$("#spnMonth2").html(1);
$("#spnYear2").html(parseInt($("#spnYear2").html()) + 1);
$("#spnYear").html($("#spnYear2").html());
}
getCalendar();
setCurrentMonth();
});
//綁定基金公司下拉框選項
$.ajax({
type: 'post',
url: 'GetData/GetFundCompanyOptionList.aspx',
dataType: "text",
data: { 'selectedValue': '' },
cache: false,
success: function(options) {
$('#sctFundCompany').append(options);
$('#sctFundCompany').change();
}
});
//綁定基金下拉框選項
$("#sctFundCompany").change(function() {
$.ajax({
type: 'post',
url: 'GetData/GetFundOptionList.aspx',
dataType: "text",
data: { 'selectedValue': '', 'fundCompany': $("#sctFundCompany").val() },
cache: false,
success: function(options) {
$('#sctFund').empty();
$('#sctFund').append(options);
},
complete: function(XMLHttpRequest, textStatus) {
//getCalendar();
}
});
});
//綁定搜尋按鈕
$('#btnSearch').click(function() {
getCalendar();
});
//頁面加載時顯示行事歷
getCalendar();
//選中當前月份
setCurrentMonth();
});
//獲取行事歷
function getCalendar() {
$.ajax({
type: 'post',
url: 'GetData/GetCalendar.aspx',
dataType: "text",
data: { 'calendarType': $('#sctCalendarType').val(), 'fundCompany': $('#sctFundCompany').val(), 'fund': $('#sctFund').val(), 'year': $('#spnYear2').html(), 'month': $('#spnMonth2').html() },
cache: false,
success: function(html) {
//alert(html);
$('#calendar_container').html(html);
}
});
}
//選中當前月份
function setCurrentMonth() {
var date = new Date();
var year = $("#spnYear").html();
var months = $("div.scalendar > table > tbody > tr > td");
$.each(months, function(i, n) {
if (year == date.getFullYear() && months[i].innerHTML == date.getMonth() + "月") {
months[i].className = "current";
} else {
months[i].className = "";
}
});
}
相关上面的代码还有一点小疑问:
$.each(months, function(i, n) {
if (year == date.getFullYear() && months[i].innerHTML == date.getMonth() + "月") {
months[i].className = "current";
} else {
months[i].className = "";
}
});
红色的部分如何使用JQuery代码替代?
0 0
- 项目代码:基金行事历JQuery代码
- 基金代码的编制规则
- 全部开放基金接口调用代码
- 全部开放基金接口调用代码
- 一段python分级基金数据收集代码
- 公司专属代码取消 基金启用新代码体系
- jquery(代码)
- 基金、项目
- 项目代码
- 天天基金估值数据接口http://j4.dfcfw.com/charts/pic6/基金代码.png
- 基于php的基金财务数据接口调用代码实例
- jqmPhp – jQuery Mobile项目的HTML代码生成器
- 8、关于Jquery的Ajax的项目代码
- 医疗项目页面的jquery代码理解最佳讲解
- jquery代码阅读jQuery.makeArray()
- jQuery的最新代码
- 自用jquery代码
- Jquery的代码简写
- SQL Server 2005 sa 用户被锁定的问题
- JQuery跨域解決方案
- 遍历Hashtable、IDictionary、Dictionary<string, string>
- javascript复制到粘贴板
- 形象工程:创建型设计模式总结
- 项目代码:基金行事历JQuery代码
- 项目代码-存储过程(复制表结构和数据、日期函数、随机数函数)
- HTC修复音乐乱码的两种方法
- SQL查询所有新闻分类且关联出每个分类下的最新的一条新闻
- JQuery动态创建表单:ie下select无法下拉(firefox正常)
- 正则表达式实例大全[个人整理]
- 正则表达式匹配Html标签
- *eclipse快速打开当前工程目录浏览文件插件EasyExplorer和OpenExplorer
- Match.Result()、Match.Groups[] 正则.NET常用