1 回答

TA貢獻1843條經(jīng)驗 獲得超7個贊
使用window.location.href =“ #SamsungStart”; 鏈接到您要訪問的ID。
<!--the Javascript function -->
function Question() {
var x=window.confirm("You have an iPhone right???")
if (x)
window.alert("Good!")
else
window.location.href = "#SamsungStart";
}
Question();
#top{
width:100%;
height:300px;
float:left;
background-color:blue;
}
.container2{
width:100%;
height:400px;
float:left;
background-color:green;
}
#galaxyInt{
width:100%;
float:left;
}
#SamsungStart{
width:100%;
float:left;
}
<!-- the html im looking to jump to -->
<div id = "top"></div>
<div class="container2">
<h2 id = "galaxyInt"><a id = "SamsungStart">Samsung Galaxy Mobile
Security</a></h2></div>
添加回答
舉報