<p id="result"/>
<meta http-equiv="refresh" content="1;URL=http://baidu.com">;
<script>
function aaa()
{
document.getElementById('result').innerText ='http://soso.com';
}
aaa();
</script>
怎么用result替换掉http://baidu.com
<p id="result"/> "</p>" 这个东西呢
代码中写法有错误
你想实现的效果是怎样的?你现在的代码是1秒后跳到百度,而下面的方法是起不到改变跳转地址的效果的
可以试试这样写,不过秒数只能比上面的小,要比meta原本的跳转先执行
<!DOCTYPE html>
<html>
<head>
<meta id="abc" http-equiv="refresh" content="1;URL=http://baidu.com">
</head>
<body>
<p id="result"/>
</body>
<script>
function aaa()
{
document.getElementById('abc').setAttribute('content','1;http://soso.com');
}
aaa();
</script>
</html>