document.writeln绑定数据 --点击跳转添加样式
2017-09-05 16:00
288 查看
document.writeln(" <div class='flex-model'>");
document.writeln(" <div class='container'>");
document.writeln(" <div class='footer'>");
document.writeln(" <a href='order.html'>");
document.writeln(" <p class='icon icon1'>
");
document.writeln(" <p class='order'>订单
");
document.writeln(" ");
document.writeln(" <a href='saleAfterSelf.html'>");
document.writeln(" <p class='icon icon2'>
");
document.writeln(" <p class='income'>售后
");
document.writeln(" ");
document.writeln(" <a href='income.html'>");
document.writeln(" <p class='icon icon3'>
");
document.writeln(" <p class='goods'>收支
");
document.writeln(" ");
document.writeln(" <a href='goods.html'>");
document.writeln(" <p class='icon icon4'>
");
document.writeln(" <p class='goods'>商品
");
document.writeln(" ");
document.writeln(" <a href='my.html'>");
document.writeln(" <p class='icon icon5'>
");
document.writeln(" <p class='my'>我
");
document.writeln(" ");
document.writeln(" ");
document.writeln("");
document.writeln(" ");
document.writeln(" ");
$(function () {
// var storage=window.localStorage;
getItem();
function getItem(){
var temp = localStorage.getItem('temp');
if(temp != null){
if(temp == 1){
$(".footer a[href ='order.html']").addClass('active').siblings().removeClass('active');
}else if(temp == 2){
$(".footer a[href ='saleAfterSelf.html']").addClass('active').siblings().removeClass('active');
}else if(temp == 3){
$(".footer a[href ='income.html']").addClass('active').siblings().removeClass('active');
}else if(temp ==4){
$(".footer a[href ='goods.html']").addClass('active').siblings().removeClass('active');
}else if(temp ==5){
$(".footer a[href ='my.html']").addClass('active').siblings().removeClass('active');
}
}
};
$(".footer a").click(function(){
//alert(1111);
var href= $(this).attr('href');
if (href == 'order.html'){
localStorage.setItem('temp',1);
}else if(href == 'saleAfterSelf.html' || href == 'returnsAfterSelf.html' || href == 'saleAfterOffter.html' || href =='returnsAfterOffter.html' || href == 'saleAfterSupply.html' || href=='returnsAfterSupply.html' || href=='saleAfterExperience.html' || href=='returnsAfterExperience.html'){
localStorage.setItem('temp',2);
}else if(href == 'income.html'){
localStorage.setItem('temp',3);
}else if(href == 'goods.html'){
localStorage.setItem('temp',4);
}else if(href == 'my.html'){
localStorage.setItem('temp',5);
}
//$(this).attr("color","red");
$(this).addClass('active').siblings().removeClass();
});
});
document.writeln(" <div class='container'>");
document.writeln(" <div class='footer'>");
document.writeln(" <a href='order.html'>");
document.writeln(" <p class='icon icon1'>
");
document.writeln(" <p class='order'>订单
");
document.writeln(" ");
document.writeln(" <a href='saleAfterSelf.html'>");
document.writeln(" <p class='icon icon2'>
");
document.writeln(" <p class='income'>售后
");
document.writeln(" ");
document.writeln(" <a href='income.html'>");
document.writeln(" <p class='icon icon3'>
");
document.writeln(" <p class='goods'>收支
");
document.writeln(" ");
document.writeln(" <a href='goods.html'>");
document.writeln(" <p class='icon icon4'>
");
document.writeln(" <p class='goods'>商品
");
document.writeln(" ");
document.writeln(" <a href='my.html'>");
document.writeln(" <p class='icon icon5'>
");
document.writeln(" <p class='my'>我
");
document.writeln(" ");
document.writeln(" ");
document.writeln("");
document.writeln(" ");
document.writeln(" ");
$(function () {
// var storage=window.localStorage;
getItem();
function getItem(){
var temp = localStorage.getItem('temp');
if(temp != null){
if(temp == 1){
$(".footer a[href ='order.html']").addClass('active').siblings().removeClass('active');
}else if(temp == 2){
$(".footer a[href ='saleAfterSelf.html']").addClass('active').siblings().removeClass('active');
}else if(temp == 3){
$(".footer a[href ='income.html']").addClass('active').siblings().removeClass('active');
}else if(temp ==4){
$(".footer a[href ='goods.html']").addClass('active').siblings().removeClass('active');
}else if(temp ==5){
$(".footer a[href ='my.html']").addClass('active').siblings().removeClass('active');
}
}
};
$(".footer a").click(function(){
//alert(1111);
var href= $(this).attr('href');
if (href == 'order.html'){
localStorage.setItem('temp',1);
}else if(href == 'saleAfterSelf.html' || href == 'returnsAfterSelf.html' || href == 'saleAfterOffter.html' || href =='returnsAfterOffter.html' || href == 'saleAfterSupply.html' || href=='returnsAfterSupply.html' || href=='saleAfterExperience.html' || href=='returnsAfterExperience.html'){
localStorage.setItem('temp',2);
}else if(href == 'income.html'){
localStorage.setItem('temp',3);
}else if(href == 'goods.html'){
localStorage.setItem('temp',4);
}else if(href == 'my.html'){
localStorage.setItem('temp',5);
}
//$(this).attr("color","red");
$(this).addClass('active').siblings().removeClass();
});
});
相关文章推荐
- 点击菜单跳转页面给点击的菜单添加新的样式
- 前端中实现页内跳转和导航栏点击实现样式,点击其他消除样式并为这一项添加样式
- 糊糊的前端学习笔记——a标签点击跳转页面后,为被点击的a标签添加样式【Day1】
- viewpager+handler获取网络数据无限自动轮播,xlistview添加头部viewpager,点击条目跳转百度
- 使用jquery当页面打开时,将修改样式的点击事件绑定到Dom
- C# ComboBox(DropDownList)数据绑定再添加一项
- MVC Ajax实现页面跳转,formSerialize绑定form数据
- 用户表(查询数据 、添加数据 、排序 、点击删除 、修改密码 、批量删除 、全部删除)
- iOS--- 动态添加了按钮,绑定同一个点击事件,如何判断点击的是哪个?
- 如何在ASPXGridView绑定数据不满一页时自动添加空行
- C#使用DropDownList绑定添加新数据的方法汇总
- 微信小程序实现给循环列表添加点击样式实例
- [★]ComboBox 经验总结[动态绑定数据之后,静态添加一条数据] 转
- 主题样式与数据绑定
- winfrom 字窗体的值传给父窗体的combox添加项后中新绑定数据,以便自己调用下拉选择改变事件
- C # 数据绑定(1)——将DataTabel的data添加ListView
- 动态添加class名,改变标签样式(包含鼠标移入、移出及点击事件)
- WPF中为ListView动态绑定数据且添加一列复选框
- iOS—TableView的点击监听和数据刷新(Alert的多种样式) -tag传值的技巧
- 小程序request接口封装,实现给循环列表添加点击样式