求助如何去水印

2022-11-22 23:07:44 +08:00
 javashell

公司内部网站上加了个水印功能,看了下大概只要把<div>标签删除就可以去水印了? 但是 div 标签的 id "ui-watermark-"和"-wrap"之间是随机生成的字符串。因为不会前端,这里请问大家怎么可以动态的删除呢?(最好给个 js 代码,谢谢大家)

<div id="ui-watermark-c7hdnb-wrap">
	<div id="ui-watermark-c7hdnb" style="display: block; pointer-events: none; position: absolute; width: 100%; height: 100%; overflow: hidden; z-index: 9999; top: 0px; left: 0px; text-align: center;">
		<div class="ui-watermark-c7hdnb-mark-line" style="overflow: hidden;">
			<div class="ui-watermark-c7hdnb-mark" style="width: 200px; height: 200px; pointer-events: none; z-index: -1; float: left; overflow: visible; opacity: 0.06; transform: rotate(-15deg); position: relative; margin-right: 0px;">
				<div style="width:100%;position:absolute;top:50%;transform:translateY(-50%);">
					<p style="pointer-events:none;font-size:14px;color:#000;"></p>
					<p>
						<span>&nbsp; <span>水印文字</span> &nbsp;</span>
						<span>&nbsp; <span>2022-11-22</span> &nbsp;</span>
					</p>
					<p></p>
				</div>
			</div>
			<div class="ui-watermark-c7hdnb-mark" style="width: 200px; height: 200px; pointer-events: none; z-index: -1; float: left; overflow: visible; opacity: 0.06; transform: rotate(-15deg); position: relative; margin-right: 0px;">
				<div style="width:100%;position:absolute;top:50%;transform:translateY(-50%);">
					<p style="pointer-events:none;font-size:14px;color:#000;"></p>
					<p>
						<span>&nbsp; <span>水印文字</span> &nbsp;</span>
						<span>&nbsp; <span>2022-11-22</span> &nbsp;</span>
					</p>
					<p></p>
				</div>
			</div>
			<div class="ui-watermark-c7hdnb-mark" style="width: 200px; height: 200px; pointer-events: none; z-index: -1; float: left; overflow: visible; opacity: 0.06; transform: rotate(-15deg); position: relative; margin-right: 0px;">
				<div style="width:100%;position:absolute;top:50%;transform:translateY(-50%);">
					<p style="pointer-events:none;font-size:14px;color:#000;"></p>
					<p>
						<span>&nbsp; <span>水印文字</span> &nbsp;</span>
						<span>&nbsp; <span>2022-11-22</span> &nbsp;</span>
					</p>
					<p></p>
				</div>
			</div>
			<div class="ui-watermark-c7hdnb-mark" style="width: 200px; height: 200px; pointer-events: none; z-index: -1; float: left; overflow: visible; opacity: 0.06; transform: rotate(-15deg); position: relative; margin-right: 0px;">
				<div style="width:100%;position:absolute;top:50%;transform:translateY(-50%);">
					<p style="pointer-events:none;font-size:14px;color:#000;"></p>
					<p>
						<span>&nbsp; <span>水印文字</span> &nbsp;</span>
						<span>&nbsp; <span>2022-11-22</span> &nbsp;</span>
					</p>
					<p></p>
				</div>
			</div>
797 次点击
所在节点    问与答
1 条回复
stein42
2022-11-22 23:40:17 +08:00
document.querySelectorAll('[class^="ui-watermark"]').forEach(e => e.remove())

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/897203

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX