发布网友
共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>