var cat = prompt("What Do You Want To Tweet??!");
if(cat.length >= 140)
{
confirm("Sorry but your Tweet was over the 140 character limit by: " + (cat.length - 140));
confirm("You need to resubmit a Tweet that is not over the 140 Character limit");
}
else{
confirm("Success, Your Tweet has been posted!");
}
//scan for websites
if (cat.search(" www ", " http ", ".com"))
{
}
else{
confirm("We have Detected a URL in your Tweet");
}
我的代码一直工作,直到我尝试“推特”一个网站。如果我输入www或.com作为推文,它会告诉我它已检测到一个好的网址。但当我输入xxxxxx www xxxxxx(x为anythingelse)时,它不会检测到网址