2017-05-07 70 views
-1
function functiont(){ 
    var a = document.getElementById("q").value; 
    var b = a.toLowerCase(); 
    var x = b.search("news"||"headline"||"headlines");//is this possible? 
    if(x != -1){ 
     $("p").text("here are the results"); 
    } else{ 
     $("p").text("sorry"); 
    } 

是以後的事可能或我要創建更多的變量和搜索所有的關鍵字?我們可以在搜索()中使用或(||)嗎?

+2

的可能的複製[您如何搜索多個字符串與.search()方法?(HTTP://計算器.COM /問題/ 12251197 /怎麼辦,您檢索用多串,用最搜索方法) – JJJ

回答

相關問題