iconName.indexOf('icon07.png')
image data does not appear in <option value="40610" selected=">
, so I would like a condition that does not occur.
Even if I write the code like this, it doesn't work.
How can I improve it?
if(calendarId)
{
variconName=$("[ownerid='"+ownerid+"]").next().children('.user-table') .children('dt') .first().children('img') .attr('src');
if(iconName.indexOf('icon04.png')!=-1)isHuman=true;
else if(iconName.indexOf('icon07.png')!=-1)isHuman=false;
else isHuman=false;
if(isHuman){
url+='allGroupUserList='+calendarId;
}
else if {
}
else
{
url+='allfacilitieList='+calendarId;
}
}
<div class="col-xs-5form-group">
<label class="col-xs-12 control-label mb5" style="float:left;" for="group_registered_userlist">Participate</label>
<select name="invitedUserCalendarResourceIds" class="col-xs-12 form-control input-sm" id="group_registered_userlist" size="8"multiple="">
<option value="40610" selected="">(I want data selected here)</option></select>
</div>
<td class="col-user">
<div class="calendar-param hidden" allmemberregisterid="40612"calendarid="40612" displayname="login user" ownerid="40519"></div>
<div class="loginuser_data">
<dl class="user-table">
<dt><img alt="src="/o/kview-scheduler-web/images/icon04.png">/dt>
<dd><span class="loginuser_user">Login user</span></dd>
<dt class="tool_mobile">img onclick="monthlyClick();" alt="""src="/o/kview-scheduler-web/images/icon05.png"></dt>
<dd></dd>
</dl>
</div>
</td>
<td class="col-user">
<div class="calendar-param hidden" allmemberregisterid="40622"calendarid="40622" displayname="other" ownerid="39653">>/div>
<div class="groupuser_data">
<dl class="user-table">
<dt><img alt="src="/o/kview-scheduler-web/images/icon04.png">/dt>
<dd><span class="groupuser_user"> Others</span></dd>
<dt class="user_post">img alt="src="/o/kview-scheduler-web/images/icon07.png">/dt>
<dd class="user_post"><span class="position">Title </span></dd>
<dt class="user_division">img alt="src="/o/kview-scheduler-web/images/icon08.png">/dt>
<dd class="user_division"><span class="department">affiliate</span></dd>
</dl>
</div>
</td>
<td class="col-user">
<div class="calendar-param hidden" allmemberregistid="246147"calendarid="246147" displayname="meeting room"ownerid="246144">
<div class="groupuser_data">
<dl class="user-table">
<dt><img alt="src="/o/kview-scheduler-web/images/icon08.png">/dt>
<dd><span class="groupuser_user">Conference Room</span>
<dd class="reserve-size"></dd>
</dl>
</div>
</td>
Even if only the code with the wrong syntax itself is written in the question, you cannot determine what you want to do.If you have image data for iconName.indexOf('icon07.png')
, please include important information such as <option value="40610" selected=">
that you want to process without select data in the question body.
The problem seems to be that we are introducing the intermediate variable isHuman
, which has only two types of true
or false
branches.(isHuman
is not declared anywhere, but that's another story.) I don't think I need to force myself to use isHuman
?
if(iconName.indexOf('icon04.png')!=-1){
url+='allGroupUserList='+calendarId;
} else if(iconName.indexOf('icon07.png')!=-1){
// Do nothing.
} else{
url+='allfacilitieList='+calendarId;
}
Or you can write it like this.
if(iconName.indexOf('icon04.png')!=-1){
url+='allGroupUserList='+calendarId;
} else if(iconName.indexOf('icon07.png')==-1) {//<-`==`
url+='allfacilitieList='+calendarId;
}
if
must be followed by a condition.The JavaScript processing system will not take into account your vague desire to move like this.
© 2024 OneMinuteCode. All rights reserved.