JavaScript 更改 iframe src 链接中的参数值
<iframe id="WANG" scrolling="no" allowtransparency="true" allowfullscreen="true" frameborder="0" src="https://www.superplayer.top/player/ec.php?code=qw&key=0&url=https://v.qq.com/x/cover/lcomt2dtd1leyfq/h0025u6zvao.html" width="100%" height="100%" style="display: inline;"></iframe>
<script>
// 获取iframe元素
var iframe = document.getElementById('WANG');
// 获取原始的src值
var src = iframe.src;
// 替换key的值为新的值
var newSrc = src.replace('key=0', 'key=newValue');
// 更新iframe的src属性
iframe.src = newSrc;
</script>
<p>请注意,上述示例中的替换过程是通过简单的字符串替换实现的,如果链接中的参数的顺序或格式发生变化,可能需要使用更复杂的方法来处理。</p>
原文地址: http://www.cveoy.top/t/topic/pCXE 著作权归作者所有。请勿转载和采集!