开发者

whats wrong with this JS

开发者 https://www.devze.com 2023-01-13 12:57 出处:网络
firebug is complaining its开发者_运维技巧 there is a syntax error if (document.getElementById(\"fromAddress\").value == \"\") ||

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

精彩评论

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