数码资讯
单元选择合并变色示例代码
周末解决一个问题,写一堆代码,功能基本上实现了,但是感觉结构太差了,没怎么考虑,根本就不漂亮。 复制代码代码如下所示: 文档的标题 表{ 边框间距:0; } TD { 身高:50px; 宽度:50px; 边框间距:0; } 隐藏{。 显示:无; } 河滨 无功selectecdlog = { };
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
周末解决一个问题,写一堆代码,功能基本上实现了,但是感觉结构太差了,没怎么考虑,根本就不漂亮。
复制代码代码如下所示:
文档的标题
表{
边框间距:0;
}
TD {
身高:50px;
宽度:50px;
边框间距:0;
}
隐藏{。
显示:无;
}
河滨
无功selectecdlog = { };
无功resultlen = 0;
无功resultbegin = 0;
VaR BackColor = {'、‘绿色'、'蓝色' }; / /承担3行1红2绿3 - Blue
无功resultcolor = 0;
$(TD).Mousedown (function () {)
selectecdlog = { };
resultcolor = BackColor { $(this)。父()。Attr('id')。Substr(1)- 1 };
$('td)。Css('background-color ',' ');
对于TR标签
/ /警报($(this)。父()。Attr('id'));
获取列编号。
警告($(this)index()+ 1);
$(这)。Css('background-color ',resultcolor);
Selectecdlog.push($(this)。Attr('id'));
/ /警报($(this)。Attr('id'));
$(TD)Mouseup(onmouseup);
$(TD),Mouseover(鼠标);
})
功能onmouseup(){
对事件进行操作
VaR resultlen len = = math.abs(parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1))- parseInt($(this),parseInt,(())(($))。
VaR开始= resultbegin = parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1(> parseInt())$本)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1($ parseInt))(这)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1(selectecdlog { 0 }。substr)):parseInt(selectecdlog { 0 }。indexOf(C)+ 1));
对于(var i = 0;i < resultlen;i++)
{
Selectecdlog.push(selectecdlog { 0 }。substr(0,2)+C+(resultbegin +我));
}
Selectecdlog.shift();
$(#日志')。文本(selectecdlog.tostring());
$(TD),Unbind('mouseover,onmouseover);
$(TD),Unbind('mouseup,onmouseup);
}
功能onmouseover(参数){
VaR resultlen len = = math.abs(parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1))- parseInt($(this),parseInt,(())(($))。
VaR开始= resultbegin = parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1(> parseInt())$本)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1($ parseInt))(这)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1(selectecdlog { 0 }。substr)):parseInt(selectecdlog { 0 }。indexOf(C)+ 1));
$('td)。Css('background-color ',' ');
为(var i = 0;i;;;;
{
$(# + selectecdlog { 0 }。substr(0,2)+C+(开始+我)),Css('background-color ',resultcolor);
}
/ /警报($(this)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1)));
/ / $(' # + TDID)。Css('background-color',');
}
每个TD / ID属性/设置
$()。每个(函数(索引,缬氨酸){)
通过数组或对象迭代
$(这)。Attr('id',$(这)。父()。Attr('id')+C+($(this)。指数()+ 1)}));
联合细胞
函数组合(参数){
/主体…
对于(var m selectecdlog)
{
如果(m=0)
{
$(# + selectecdlog {米})。Attr('colspan ',resultlen);
$(# + selectecdlog {米})。Css('width ',resultlen * 50 +PX);
/ / $(' # + selectecdlog {米})。Css('background-color ','bule);
}
别的{
$(# + selectecdlog {米})。AddClass(隐藏的);
}
}
}
复制代码代码如下所示:
文档的标题
表{
边框间距:0;
}
TD {
身高:50px;
宽度:50px;
边框间距:0;
}
隐藏{。
显示:无;
}
河滨
无功selectecdlog = { };
无功resultlen = 0;
无功resultbegin = 0;
VaR BackColor = {'、‘绿色'、'蓝色' }; / /承担3行1红2绿3 - Blue
无功resultcolor = 0;
$(TD).Mousedown (function () {)
selectecdlog = { };
resultcolor = BackColor { $(this)。父()。Attr('id')。Substr(1)- 1 };
$('td)。Css('background-color ',' ');
对于TR标签
/ /警报($(this)。父()。Attr('id'));
获取列编号。
警告($(this)index()+ 1);
$(这)。Css('background-color ',resultcolor);
Selectecdlog.push($(this)。Attr('id'));
/ /警报($(this)。Attr('id'));
$(TD)Mouseup(onmouseup);
$(TD),Mouseover(鼠标);
})
功能onmouseup(){
对事件进行操作
VaR resultlen len = = math.abs(parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1))- parseInt($(this),parseInt,(())(($))。
VaR开始= resultbegin = parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1(> parseInt())$本)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1($ parseInt))(这)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1(selectecdlog { 0 }。substr)):parseInt(selectecdlog { 0 }。indexOf(C)+ 1));
对于(var i = 0;i < resultlen;i++)
{
Selectecdlog.push(selectecdlog { 0 }。substr(0,2)+C+(resultbegin +我));
}
Selectecdlog.shift();
$(#日志')。文本(selectecdlog.tostring());
$(TD),Unbind('mouseover,onmouseover);
$(TD),Unbind('mouseup,onmouseup);
}
功能onmouseover(参数){
VaR resultlen len = = math.abs(parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1))- parseInt($(this),parseInt,(())(($))。
VaR开始= resultbegin = parseInt(selectecdlog { 0 }。substr(selectecdlog { 0 }。indexOf(C)+ 1(> parseInt())$本)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1($ parseInt))(这)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1(selectecdlog { 0 }。substr)):parseInt(selectecdlog { 0 }。indexOf(C)+ 1));
$('td)。Css('background-color ',' ');
为(var i = 0;i;;;;
{
$(# + selectecdlog { 0 }。substr(0,2)+C+(开始+我)),Css('background-color ',resultcolor);
}
/ /警报($(this)。Attr('id')。Substr(($(this)。Attr('id')。IndexOf(C))+ 1)));
/ / $(' # + TDID)。Css('background-color',');
}
每个TD / ID属性/设置
$()。每个(函数(索引,缬氨酸){)
通过数组或对象迭代
$(这)。Attr('id',$(这)。父()。Attr('id')+C+($(this)。指数()+ 1)}));
联合细胞
函数组合(参数){
/主体…
对于(var m selectecdlog)
{
如果(m=0)
{
$(# + selectecdlog {米})。Attr('colspan ',resultlen);
$(# + selectecdlog {米})。Css('width ',resultlen * 50 +PX);
/ / $(' # + selectecdlog {米})。Css('background-color ','bule);
}
别的{
$(# + selectecdlog {米})。AddClass(隐藏的);
}
}
}
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。