代码隐藏:动态显示/隐藏HTML元素 [英] Code-behind: dynamically display / hide a HTML element
本文介绍了代码隐藏:动态显示/隐藏HTML元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于HTML元素,我可以通过
For an HTML element , I can dynamically hide it by
sourceDoc1.Attributes["style"] = "display: none";
隐藏后,但我无法将其显示为
After it is hidden, but I can't turn it to displayed by
sourceDoc1.Attributes["style"] = "display: block";
我的'开启'代码出了什么问题?谢谢。
我的尝试:
代码隐藏:动态显示/隐藏HTML元素
推荐答案
尝试:
Try:
sourceDoc1.Style["display"] = "none";
和:
and:
sourceDoc1.Style["display"] = "block";
如果这不起作用,你需要检查渲染的HTML,并使用浏览器的开发人员工具检查元素,看看为什么它不可见。
If that doesn't work, you'll need to examine the rendered HTML, and use the browser's developer tools to inspect the element to see why it's not visible.
这篇关于代码隐藏:动态显示/隐藏HTML元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文