繁体   English   中英

如何使用 DOM (*object*.style) 更改 iframe 的灰度?

[英]How do I change the grayscale of an iframe using DOM (*object*.style)?

按下某个按钮后,我需要将灰度更改为 iframe 的 100%。 这是我的部分代码的基本版本:

HTML:

                    <tr>
                        <td>
                            <p class = "text">
                                Would you like to turn the colors into black and white?
                            </p>
                        </td>
                        <td>
                            <input type = "radio" id = "blackandwhiteyes" name = "blackandwhite" value = "blackandwhiteyes" required>
                        </td>
                        <td>
                            <input type = "radio" id = "blackandwhiteno" name = "blackandwhite" value = "blackandwhiteno" required>
                        </td>
                    </tr>

JavaScript:

blackandwhiteyes.onclick = function () {
    numiframe.style.(*What do I enter here to make the grayscale change?*);
}

提前致谢!

您可以使用filter CSS 属性。

numiframe.style.filter = "grayscale(100%)";

参见: 灰度

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM