You need to use Javascript. write a function in javascript and call it on button onclientclick
function checkString()
{
if (document.getElementById("txtVal1").value == document.getElementById("txtVal2").value)
{
if(confirm("String are same, Do you want to continue"))
alert("you clicked yes")
else
alert("you clicked no")
}
else
{
if(confirm("The Two value are different, Do u want to Continue"))
alert("you clicked yes")
else
alert("you clicked no")
}
}