var dd=confirm("How are you");
if(dd){          //if (dd==true)
  alert("yes")
}else{           //if (dd==false)
  alert("cancel")
}

解决方案 »

  1.   

    if (confirm("How are you"))
      window.alert("You click yes!);
    else
      window.alert("You click no!);
      

  2.   

    点“yes”返回true, 否则返回false
      

  3.   

    我也来参合,confirm()方法有一个返回值,if (confirm("是确定还是取消")) alert("确定");
    else alert("取消");
      

  4.   

    because the confirm only had two value. one is true. and other is flase.
      

  5.   

    Try the codes below :---------------------------------------------------------------
    <input type="button" name="button" value="Click to Confirm" onclick="if (confirm('Are you sure to Del the item ?')){alert('You Clicked : \nYes');return false;}else{alert('You clicked : \nNo');return false;}">
    ---------------------------------------------------------------