首页 热点专区 义务教育 高等教育 出国留学 考研考公

我有两个web网页A,B A有一个按钮,点击它,页面从A跳转到B,如何实现,用h...

发布网友

我来回答

2个回答

热心网友

<!--a.html-->
<script type="text/javascript">
function redirect()
{
if(document.getElementById("c").value == document.getElementById("d").value)
{
window.location.href="b.html"; //跳转到b网页
}
}
</script>

<input id=c><input id=d>
<input type="button" onClick=redirect() value="按钮"></input>追问非常谢谢,再问一句,如果我想连接到 比如 百度, 而不是本地html, 同样的问题该如何解决呢? 不能用window.location了

追答window.location.href="http://www.baidu.com/"; //跳转到百度

为什么不能用 window.location 呢?

热心网友

onclick="javascript:window.open(b.html,'_self')“;

<input type="button" onclick="javascript:window.open(b.html,'_self')“; value="按钮"></input>

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com