First I created a simple button
<button type="button" class="button" onclick="myFunction()">Press me please</button>
and the javascript
<script>
function myFunction()
{
var answer = confirm ("Yes")
if (answer)
window.location.assign("page1.html")
else
window.location.assign("page2.html")
}
</script>