保存地址栏文件名有顺序的图片或网页的小工具

 

使用方法:

将代码粘贴到控制台,然后回车,左上角会出现一个按钮,可以点击按钮切换到下一页。虽然方法或许low,但是实在不愿意更改地址栏那个数字,太不好选择了。


var saveImg={
last:function(){
var href=window.location.href;
var line=href.lastIndexOf('/');
var dot=href.lastIndexOf('.');
var con=href.slice(0,line+1);
var last=href.slice(dot);
var num=href.slice(line+1,dot)/1+1;
console.log(con+num+last);
window.location.href=con+num+last;
},
appChild:function(){
var btn = document.createElement("input");//js新建元素
btn.onclick = this.last;//给元素添加点击事件
btn.setAttribute("type", "button");//给元素加属性
btn.setAttribute("value", "下一张");//给元素加属性
btn.style.position = "fixed";//js设置样式
btn.style.top = "20px";//js设置样式
btn.style.left = "20px";//js设置样式
btn.style.width= "100px";//js设置样式
btn.style.height = "30px";//js设置样式
btn.style.fontSize = "20px";//js设置样式
btn.style.color = "red";//js设置样式
btn.style.fontWeight = "bold";//js设置样式
document.body.appendChild(btn);//把元素放进body标签里面
}
}
saveImg.appChild();
 

 

posted @ 2016-05-11 21:56  HALEY168  阅读(257)  评论(0编辑  收藏  举报