声明源文件中是否还有其他文件

声明源文件中是否还有其他文件

本文介绍了声明源文件中是否还有其他文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在源文件中使用其他代码,这是我的代码:

I want to use if else in source file, here is my code:

<span style="float: left; width: 100px; text-align: center; margin-right: 10px; margin-bottom: 10px">
        <a href='../profile.aspx?member_id=<%=comments_member_id%>'>
            <img alt="<%=member_name%>" title="<%=member_name%>" src='../img/avatars/<%=img_url%>' style="width: 80px; height: 80px">

            <img alt="<%=member_name%>" title="<%=member_name%>" src="../img/blank.gif" style="width: 80px; height: 80px">
        </a>
        </span>


如果img_url不为null,我将在这里使用它显示第一个图像.
否则显示第二张图片,所以请告诉我如果在那里还有其他地方该如何使用.

在此先感谢


here i wnt to use if img_url is not null then it display first image.
else display the second image, so please tell me how can i use if else in there.

Thanks in advance

推荐答案

<% if (1 = 1) {%>
<img alt="<%=member_name%>" title="<%=member_name%>" src="../img/avatars/<%=img_url%>" style="width: 80px; height: 80px">
<%} else {%>
<img alt="<%=member_name%>" title="<%=member_name%>" src="../img/blank.gif" style="width: 80px; height: 80px">
<% }%>



您也可以使用javascript.



Also you can use javascript.

<script type="text/javascript">
if (1=1)/*Change your conditions here*/
  {
   document.getElementById("image1").style.display = "none";
   document.getElementById("image2").style.display = "block";
  }
else
  {
   document.getElementById("image1").style.display = "block";
   document.getElementById("image2").style.display = "none";
  }
</script>


<% if (member_name == "")%>
<pre lang="xml"><img alt="<%=member_name%>" title="<%=member_name%>" src='../img/avatars/<%=img_url%>' style="width: 80px; height: 80px">


]]>


]]>

<img alt="<%=member_name%>" title="<%=member_name%>" src="../img/blank.gif" style="width: 80px; height: 80px">



<img alt="<%=member_name%>" title="<%=member_name%>" src=''<%= string.IsNullOrEmpty(img_url) ? "../img/blank.gif" : "../img/" + img_url %> style="width: 80px; height: 80px">



如果使用asp图像控件,则需要类似这样的



If you use asp image control, then you need to similar like this

<asp:Image ID="imgOnOff" runat="server" ImageUrl=''<%#(DataBinder.Eval(Container.DataItem,"b_default_value").ToString()=="True")?"~/Images/checkboxOn.gif":"~/Images/checkboxOff.gif"%>'' />


这篇关于声明源文件中是否还有其他文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 15:21