<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>confirm</title>
<script type="text/javascript">
function rec(){
var mymessage=("你是卡西奥佩娅吗?" );
if(mymessage==true)
{
document.write("你是女士!");
} confirm
else
{
document.write("你是男士!");
}
}
</script>
</head>
<body>
<input name="button" type="button" onClick="rec()" value="点击我,弹出确认对话框" />
</body>
</html>
z你的代码中间多了一个东西
把document.write改成alert就行了
没有用引用confirm
你要把这里的confirm删掉才可以
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>confirm</title>
<script type="text/javascript">
function rec(){
var mymessage=confirm("你是卡西奥佩娅吗?" );
if(mymessage==true)
{
document.write("你是女士!");
} confirm
else
{
document.write("你是男士!");
}
}
</script>
</head>
<body>
<input name="button" type="button" onClick="rec()" value="点击我,弹出确认对话框" />
</body>
</html>我补充了一下也还是没有返回值