Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用if/else语句显示图像?_Javascript_Image_Function_If Statement - Fatal编程技术网

Javascript 如何使用if/else语句显示图像?

Javascript 如何使用if/else语句显示图像?,javascript,image,function,if-statement,Javascript,Image,Function,If Statement,有人使用该工具后,我如何获得要显示的图像 基本上,您可以运行该工具来查看您的手机与哪个运营商兼容。它目前非常简单,但我希望有一个图像显示后,你已经选择了你的手机型号和运行该工具。例如,如果您选择了运营商和您自己的iPhone 7,我希望在iPhone 7运行后显示其图像 我在Stackoverflow上尝试了几个例子,但似乎没有任何效果,因为它们与构建它的方式有点不同。如果有人能给我指出正确的方向或告诉我该怎么做,那将是传奇。谢谢 函数检查iphonecompatibility(){ var

有人使用该工具后,我如何获得要显示的图像

基本上,您可以运行该工具来查看您的手机与哪个运营商兼容。它目前非常简单,但我希望有一个图像显示后,你已经选择了你的手机型号和运行该工具。例如,如果您选择了运营商和您自己的iPhone 7,我希望在iPhone 7运行后显示其图像

我在Stackoverflow上尝试了几个例子,但似乎没有任何效果,因为它们与构建它的方式有点不同。如果有人能给我指出正确的方向或告诉我该怎么做,那将是传奇。谢谢

函数检查iphonecompatibility(){
var wo$=$;
var carrier=wo$(“#检查兼容性carrier”).val();
var phone=wo$('#检查兼容性phone').val();
如果(电话==''|运营商==''){
wo$(“#检查兼容性消息”).html('请选择运营商和电话型号');
}否则{
var网络=“”;
var搜索=“”;
开关(电话){
案例“5X”:
如果(载波=='att'){
网络=‘AT&T、T-Mobile、Sprint和Verizon’;
搜索=“”;
}
如果(运营商=='sprint'){
网络=‘Sprint、T-Mobile、Verizon和AT&T’;
搜索=“”;
}
如果(运营商=='verizon'){
networks=‘Verizon、T-Mobile、AT&T和Sprint’;
搜索=“”;
}
如果(载波=='tmobile'){
networks=‘AT&T、Verizon、Sprint和T-Mobile’;
搜索=“”;
}
打破
案例“Nexus”:
如果(载波=='att'){
网络=‘AT&T、T-Mobile、Sprint和Verizon’;
搜索=“”;
}
如果(运营商=='sprint'){
网络=‘Sprint、T-Mobile、Verizon和AT&T’;
搜索=“”;
}
如果(运营商=='verizon'){
networks=‘Verizon、T-Mobile、AT&T和Sprint’;
搜索=“”;
}
如果(载波=='tmobile'){
网络=‘T-Mobile、Verizon、Sprint和AT&T’;
搜索=“”;
}
打破
案例“6P”:
如果(载波=='att'){
网络=‘AT&T、T-Mobile、Sprint和Verizon’;
搜索=“”;
}
如果(运营商=='sprint'){
网络=‘Sprint、T-Mobile、Verizon和AT&T’;
搜索=“”;
}
如果(运营商=='verizon'){
networks=‘Verizon、T-Mobile、AT&T和Sprint’;
搜索=“”;
}
如果(载波=='tmobile'){
网络=‘T-Mobile、Verizon、Sprint和AT&T’;
搜索=“”;
}
打破
“像素”大小写:
如果(载波=='att'){
网络=‘AT&T、T-Mobile、Sprint和Verizon’;
搜索=“”;
}
如果(运营商=='sprint'){
网络=‘Sprint、T-Mobile、Verizon和AT&T’;
搜索=“”;
}
如果(运营商=='verizon'){
networks=‘Verizon、T-Mobile、AT&T和Sprint’;
搜索=“”;
}
如果(载波=='tmobile'){
网络=‘T-Mobile、Verizon、Sprint和AT&T’;
搜索=“”;
}
打破
案件‘530’:
如果(载波=='att'){
网络=‘AT&T、T-Mobile、Sprint和Verizon’;
搜索=“”;
}
如果(运营商=='sprint'){
网络=‘Sprint、T-Mobile、Verizon和AT&T’;
搜索=“”;
}
如果(运营商=='verizon'){
networks=‘Verizon、T-Mobile、AT&T和Sprint’;
搜索=“”;
}
如果(载波=='tmobile'){
网络=‘T-Mobile、Verizon、Sprint和AT&T’;
搜索=“”;
}
打破
案件‘626s’:
如果(载波=='att'){
网络=‘AT&T、T-Mobile、Sprint和Verizon’;
搜索=“”;
}
如果(运营商=='sprint'){
网络=‘Sprint、T-Mobile、Verizon和AT&T’;
搜索=“”;
}
如果(运营商=='verizon'){
networks=‘Verizon、T-Mobile、AT&T和Sprint’;
搜索=“”;
}
如果(载波=='tmobile'){
网络=‘T-Mobile、Verizon、Sprint和AT&T’;
搜索=“”;
}
打破
案例“7”:
如果(载波=='att'){
网络=‘AT&T、T-Mobile、Sprint和Verizon’;
搜索=“”;
}
如果(运营商=='sprint'){
网络=‘Sprint、T-Mobile、Verizon和AT&T’;
搜索=“”;
}
如果(运营商=='verizon'){
networks=‘Verizon、T-Mobile、AT&T和Sprint’;
搜索=“”;
}
如果(载波=='tmobile'){
网络=‘T-Mobile、Verizon、Sprint和AT&T’;
搜索=“”;
If(phone=="iphone7"){
$("#img").attr("src","iphone7.png");
}