我用 JavaScript 写了一个电话号码保护程序。一切正常,但是当我在搜索框中搜索名称或数字时,没有显示结果:
function contact() {
var nam1=prompt("Please enter the name");
var num1=prompt("please enter the phone number");
}
contact();
function search() {
var searc= prompt("Please enter the name of your contact or phone number");
}
search();
//search box
if ( searc == nam1 ) {
alert("The phone Number is , " + num1);
}
if ( searc == num1 ) {
alert("The Contact Name is , " + nam1);
}