You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
568tools/js/incert.js

20 lines
636 B

// 获取 URL 参数
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
// 替换 iframe 中的网页并聚焦视角
function replaceIframeSource() {
var link = getUrlParameter('link');
if (link) {
var iframe = document.getElementById('myIframe');
iframe.src = link;
iframe.scrollIntoView({ behavior: 'smooth' });
}
}
// 页面加载完成时调用替换函数
window.onload = replaceIframeSource;