-1

我想在脚本中插入这个以重定向页面

<div id="hello">

<div>You are going to be redirected!</div>

<p>http://www.google.com</p>

会变成

<div id="hello">

<div>You are going to be redirected!</div>

<script type="text/javascript">
window.location = "http://www.google.com"
</script>

</div>

我不知道如何<p>替换</p>

<script type="text/javascript">
window.location = "

"
</script>
4

1 回答 1

2

假设这就是您页面中内容的全部内容,请尝试以下操作:

location.href = document.getElementsByTagName('p')[0].firstChild.nodeValue;
于 2013-06-04T01:10:00.697 回答