电脑技术学习

对选择按钮的判断,选择不同就会有不同的内容提示

dn001

<!-- 第一步:把如下代码加入<body>区域中 -->
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function getInfo() {

doyou = confirm("考虑一下选择哪个哟? (OK = YesCancel = No)"); //Your question.

if (doyou == true)

alert("呵呵,你选择了'Yes',你真勇敢哟"); //If your question is answered Yes.

else

if (doyou == false)

alert("怎么能选择'NO'呢?难道你不怕倒霉吗?"); //If your question is answered No.


if (doyou == false)

history.go(-1); //After answered No, the action. (In < this < case, it sends you back 1 page!)

}
//; End -->
</script>

<!-- 第二步:把如下代码加入<body>区域中 -->
<body; onLoad="getInfo()">