如果条件为真,则必须显示图像 [英] if the condition is true it has to display an image
本文介绍了如果条件为真,则必须显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在if语句中,如果值为true,则必须显示一个图像.否则,我必须显示另一幅图像.
我的代码:
In the if statement, if the value is true i have to display one image.else i have to display another image.
My code:
function IsActveDisplay(status) {
if (status == "1")
return "success";
else
return "Failed";
}
现在它根据条件返回成功和失败.代替的是,我想要两个不同的图像.
now it is returning success and failed depending up on the condition.inplace of that i want two different images.
推荐答案
获取两个图像按钮并提供图像url'' s到这些图像按钮,并在页面加载中将代码写为
Take two image buttons and give the image url''s to those image buttons and write the code in page load as
imagebutton1.visible=false;
imagebutton2.visible=false;
在If条件中,您应将代码编写为
And in If condition you should write the code as
if(status==1)
imagebutton1.visible=true;
else if
imagebutton2.visible=true;
first您可以在aspx代码中以及if条件下同时隐藏图像可见性false是的,您可以看到您的图像.
first You can hide both image visibility false in your aspx codeand during if condition true, you can visible your image.
function IsActveDisplay(status) {
if (status == "1")
{
image1.visible=true;
}
else
{
image2.visible=true;
}
}
这篇关于如果条件为真,则必须显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文