开发者

whats wrong with this JS

firebug is complaining its开发者_运维技巧 there is a syntax error

if (document.getElementById("fromAddress").value == "") || 
(document.getElementById("fromAddress").value == "Enter Address, City, Directions") {   


You are missing the parenthesis, that being said you are better off writing it like this.

var from = document.getElementById("fromAddress").value;
if (from  === "" || from  === "Enter Address, City, Directions") { 


You need to wrap the entire conditional statement in parans:

if ( (blah) || (blah) )
   ^                  ^
{
  // as you were
}


You have mis-match of parenthesis, try this:

if ((document.getElementById("fromAddress").value == "") || 
(document.getElementById("fromAddress").value == "Enter Address, City, Directions")){...}


Corrected form: (removed 2 parentheses)

if (document.getElementById("fromAddress").value == "" || document.getElementById("fromAddress").value == "Enter Address, City, Directions") {

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜