Códigos de función a insertar
// 获取IP地址的函数
function getIPAddress() {
// 使用一个公共的IP地址获取服务
fetch('https://api.ipify.org?format=json')
.then(response => response.json())
.then(data => {
// 从JSON响应中获取IP地址
const ipAddress = data.ip;
// 将IP地址复制到字段AA
document.getElementById('input_3').value = ipAddress;
})
.catch(error => {
console.error('获取IP地址失败:', error);
});
}
// 调用获取IP地址的函数
getIPAddress();
// 在网页加载完成后等待5秒后执行的函数
window.onload = function() {
setTimeout(function() {
// 获取字段C的值
const cFieldValue = document.getElementById('input_9').value;
// 确保字段C的值不为空
if (cFieldValue.trim() !== '') {
// 打开链接在当前窗口中
window.location.href = cFieldValue;
} else {
console.error('字段C的值为空,无法打开链接。');
}
}, 5000); // 5000毫秒(5秒)的延迟
};