有人能告诉我我做错了吗?
以下是我在.js文件中的Javascript代码:
function call_alert()
{
alert (result);
}
var a = true; , b = false;
var test1 = (a && a);
var test2 = (a && b);
var test3 = (b && b);
var result = "Are they true? \n";
result += "1:" +test1+;
为简单起见,我没有包含变量test2和test3。
我的HTML只是标准<body onload ="call_alert()">
。
答案 0 :(得分:0)
尝试这样可以正常工作
function call_alert()
{
alert (result);
}
var a = true;
var b = false;
var test1 = (a && a);
var test2 = (a && b);
var test3 = (b && b);
var result = "Are they true? \n";
result += "1:" +test1;
答案 1 :(得分:0)
不太确定你想要做什么,但我会试一试。
var a = true, b = false;
function callAlert() {
alert (result);
}
var test1 = (a && a);
var test2 = (a && b);
var test3 = (b && b);
var result = "Are they true? y" + "/" + "n";
result += " 1 " + test1;