為什么這樣寫得取反才能實(shí)現(xiàn)啊 哪位大佬告訴我
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>confirm</title>
? <script type="text/javascript">
? ? var message;?
? ? function male(){
? ? ?message = "你是男的還是女的";
? ? ?confirm(message);
? ? ? ? if(message!=true){
? ? ? ? ? ? document.write("你是男的");
? ? ? ? }else{
? ? ? ? ? ? document.write("你是女的");
? ? ? ? }
? ? }
? ? ? ??
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="male()" value="點(diǎn)擊我,彈出確認(rèn)對話框" />
</body>
</html>
2018-12-25
兄弟,你這個(gè)咋不管確認(rèn)還是取消都顯示“你是男的”?
2018-10-01
你把massage定義為字符串類型,又怎么能用if條件去判斷?在massage前面加上confirm()就可以了,因?yàn)閏onfirm(massage)返回的是Boolean類型的值,才能在if()語句中判斷。
2018-09-29
不取反也行,看你怎么理解,代碼怎么寫了。