gpt4 book ai didi

javascript - 在现有脚本中显示/隐藏 div

转载 作者:太空宇宙 更新时间:2023-11-03 18:18:57 25 4
gpt4 key购买 nike

我有一个现有脚本,可以在按下按钮时在我的网站上执行某个功能。有没有办法让这个按钮同时显示一个div?当你访问谷歌主页时,你会看到这个; enter image description here然而,当您按谷歌搜索时,您会遇到这个; enter image description here

我知道这是一个具有不同 url 的不同页面,但是有没有办法通过显示/隐藏 div 来实现这一点?我不介意人们禁用 javascript,因为无论如何我的系统都需要它!

最佳答案

我找到了答案:jquery: change the URL address without redirecting?

document.location.hash = "show_picture";

Javascript 只能控制# 之后的内容,google 也是这么做的。通过这一行,您可以重置 #

后面的内容

关于javascript - 在现有脚本中显示/隐藏 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22257444/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com