满足特定 URL 参数时显示 <div>

问题描述

我在 Google 表格中有一个表单,它将 URL 参数传递给一个页面,然后该页面应该根据 URL 参数显示内容。

因此,如果一个人在 Google Sheet 中检查“item 1”和“item 2”,参数会按如下方式传递:

https://my-url.com/?item1=value1&item2=value2

现在有几个 div 容器,使用 css 设置为 display:none。当满足 URL 参数时,隐藏的 div 容器应该显示出来。所以html是:

<div class="hidden" id="value1">This content should show,when the URL parameter value 1 is passed</div>
<div class="hidden" id="value2">This content should show,when the URL parameter value 2 is passed</div>

我在网上找到了一些代码,它几乎可以做到这一点,但它一次只能显示一个 div:https://jennamolby.com/how-to-display-dynamic-content-on-a-page-using-url-parameters/

我的问题是,对于每个传递的参数,必须显示一个字段。

谁能帮我解决这个问题?无论如何,我真的不是 js 专家。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)