assistantbot / UI /JS /ShowAndDisable.py
ifey's picture
Duplicate from ifey/chatdemo
ffc02c6
raw
history blame contribute delete
1.23 kB
# 定义一个 JavaScript 函数来隐藏按钮
#block:元素以块级元素的形式显示,占据整行的空间,前后都会换行。
#inline:元素以内联元素的形式显示,不会占据整行的空间,可以在文本中显示,前后都不会换行。
#none:元素不在页面上显示,且不会占据任何空间。
#flex:元素以弹性布局的形式显示,通常用于构建复杂的页面布局。
#grid:元素以网格布局的形式显示,通常用于构建二维的页面布局。
def GetShowObject(id):
hide_button_js = f"""
function hideButton() {{
var button = document.getElementById('{id}');
button.style.display = 'block';
}}
"""
return hide_button_js
def GetHideObject(id):
hide_button_js = f"""
function hideButton() {{
var button = document.getElementById('{id}');
button.style.display = 'none';
}}
"""
return hide_button_js
def HindObjectJs(id):
hide_button_js = f"""document.getElementById('{id}').style.display = 'none'"""
return hide_button_js
def ShowObjectJs(id):
hide_button_js = f"""document.getElementById('{id}').style.display = 'block'"""
return hide_button_js