首页 > Web开发 > 详细

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

时间:2016-05-11 23:23:54      阅读:285      评论:0      收藏:0      [点我收藏+]

 

使用方法:

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

function last(){
    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;
}
function appChild(){
    var btn = document.createElement("input");//js新建元素
    btn.onclick = 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标签里面
}
appChild();

技术分享技术分享

 

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

原文:http://www.cnblogs.com/haley168/p/tools_img.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!