在左上角制作一个重新加载按钮

发布于 2024-10-10 03:21:56 字数 99 浏览 0 评论 0原文

如何在网站的左角获得重新加载按钮? 我希望它是透明的,宽度:60px,高度:40px

我需要输入什么才能让它在我的: .js 文件 .CSS 文件 索引.html 文件

How do i get a reloadbutton on my left corner 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缱倦旧时光 2024-10-17 03:21:56

这很容易做到,但您可能需要更改 CSS 中的样式,除非您希望按钮完全透明。这只是在单击时重新请求当前页面。

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,紧接在开始正文标记之后

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

祝你好运!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文