开发者

Make a reloadbutton on left corner

开发者 https://www.devze.com 2023-02-02 15:26 出处:网络
How do i get a reloadbutton on my left corne开发者_StackOverflow中文版r of site? I want it transparent and width:60px and height:40px

How do i get a reloadbutton on my left corne开发者_StackOverflow中文版r of site? I want it transparent and width:60px and height:40px

What do i need to type to get it work in my: .js file .CSS file index.html file


This is easy to do, though you'll probably need to change the style in the CSS unless you want the button to be completely transparent. This just re-requests the current page when clicked.

CSS

#reloadButton {
    top: 0;
    left: 0;
    background: transparent;
    display: block;
    width: 60px;
    height: 40px;
}

Javascript

var reload = document.getElementById("reloadButton");
reload.onclick = window.location.reload();

index.html, immediately after the opening body tag

<a href="javascript:;" id="reloadButton"></a>

Good luck!

0

精彩评论

暂无评论...
验证码 换一张
取 消