if (document.getElementById("fromAddress").value == "") ||
(document.getElementById("fromAddress").value == "Enter Address, City, Directions") {
答案 0 :(得分:7)
你缺少括号,据说你最好这样写。
var from = document.getElementById("fromAddress").value;
if (from === "" || from === "Enter Address, City, Directions") {
答案 1 :(得分:4)
您需要在parans中包含 整个 条件语句:
if ( (blah) || (blah) )
^ ^
{
// as you were
}
答案 2 :(得分:1)
你有 括号错误 ,试试这个:
if ((document.getElementById("fromAddress").value == "") ||
(document.getElementById("fromAddress").value == "Enter Address, City, Directions")){...}
答案 3 :(得分:1)
更正后的表格:(删除了2个括号)
if(document.getElementById(“fromAddress”)。value ==“”|| document.getElementById(“fromAddress”)。value ==“输入地址,城市,方向”){