【问题标题】:Python button to change style of html div用于更改 html div 样式的 Python 按钮
【发布时间】:2016-12-21 20:53:07
【问题描述】:

我在 python 中有一个项目,当我的图标被点击时会隐藏一个 div,然后在再次点击它时折叠。现在我有以下html代码

<img scr="/path/to/img"></img>
<div>
    <p>Press the icon to see more stuff</p>
</div>

<div id="showOrHide" style="display: none;">
    <p>one</p>
    <p>two</p>
    <p>three</p>
</div>

所以我的问题是,当用户单击图像时,删除 id 为 showOrHide 的 div 上的样式的最佳方法是什么?

谢谢!

【问题讨论】:

标签: python html css


【解决方案1】:

Python 不适合做你想要完成的事情——你没有办法使用 Javascript 吗?一个简单的 onclick() http://www.w3schools.com/jsref/event_onclick.asp 将在 JS 中完成工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-11
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 2014-09-23
    • 1970-01-01
    • 2014-12-04
    相关资源
    最近更新 更多