js動態字串拼接案例
阿新 • • 發佈:2019-02-13
/*點選新增分組事件*/
addApp_group.unbind('click');
addApp_group.click(function(){
$('.applyAdd').hide(); //保證點選“新增應用”後彈出div處於隱藏狀態
/*addApp_new.slideUp(sliderTime);
addApp_input.slideDown(sliderTime); return false; 點選'新增分組' h 5.13*/
if(addApp_input.css('display') == 'none'){
addApp_new.slideUp(sliderTime); //暫無作用
addApp_input.slideDown(sliderTime);
return false;
}else{
addApp_input.slideUp(sliderTime)
}
});
addApp_name.unbind('blur');
addApp_name.blur (function(){
var appNameVal = addApp_name.val();
if($.trim(appNameVal) == '' || $.trim(appNameVal) == appNameVal_def){
$.messager.alert('提示',"分組名不能為空!");
return false;
}
$.post(addAppGroupUrl,{appNameVal:appNameVal},function(m){
if(m.code !== 0){
$.messager.alert('提示',m.msg);
return false;
}
addApp_input.slideUp(sliderTime);
var appRigth = $('.right');
var tmpHtml = '';
tmpHtml += '<div class="defaultApp">'
+ '<div class="defaultApp_title" title="'+appNameVal+'" app_group_id="'+m.id+'">'
+'<span class="defaultApp_name">'
+ appNameVal
+'<input type="hidden" name="app_group_id" value="'+m.id+'"/>'
+'</span>';
if(m.id > 1){
tmpHtml += '<span class="move_up">上移</span>'
+'<span class="move_down">下移</span>'
+'<span class="del_group">刪除組</span>';
}
tmpHtml += '<span class="defaultApp_move">轉移至</span>'
+ '<div class="add_menu hidden" >'
+ '<ul class="add_menu_list">'
+ '</ul>'
+ '</div>'
+ '</div>'
+ '<div class="businessphoto">'
+ '<ul>'
+ '</ul>'
+ '<div class="clearing"></div>'
+ '</div>'
+ '<div class="addApp_new editAppCon hidden">'
+ '</div>'
+ '</div>';
appRigth.append(tmpHtml);
$('.addApp_name').val('請輸入4~6個字元,支援中文,英文');
},'json');
// return false; h
});
}
addApp_group.unbind('click');
addApp_group.click(function(){
$('.applyAdd').hide(); //保證點選“新增應用”後彈出div處於隱藏狀態
/*addApp_new.slideUp(sliderTime);
addApp_input.slideDown(sliderTime); return false; 點選'新增分組' h 5.13*/
if(addApp_input.css('display') == 'none'){
addApp_new.slideUp(sliderTime); //暫無作用
addApp_input.slideDown(sliderTime);
return false;
}else{
addApp_input.slideUp(sliderTime)
}
});
addApp_name.unbind('blur');
addApp_name.blur (function(){
var appNameVal = addApp_name.val();
if($.trim(appNameVal) == '' || $.trim(appNameVal) == appNameVal_def){
$.messager.alert('提示',"分組名不能為空!");
return false;
}
$.post(addAppGroupUrl,{appNameVal:appNameVal},function(m){
if(m.code !== 0){
$.messager.alert('提示',m.msg);
return false;
}
addApp_input.slideUp(sliderTime);
var appRigth = $('.right');
var tmpHtml = '';
tmpHtml += '<div class="defaultApp">'
+ '<div class="defaultApp_title" title="'+appNameVal+'" app_group_id="'+m.id+'">'
+'<span class="defaultApp_name">'
+ appNameVal
+'<input type="hidden" name="app_group_id" value="'+m.id+'"/>'
+'</span>';
if(m.id > 1){
tmpHtml += '<span class="move_up">上移</span>'
+'<span class="move_down">下移</span>'
+'<span class="del_group">刪除組</span>';
}
tmpHtml += '<span class="defaultApp_move">轉移至</span>'
+ '<div class="add_menu hidden" >'
+ '<ul class="add_menu_list">'
+ '</ul>'
+ '</div>'
+ '</div>'
+ '<div class="businessphoto">'
+ '<ul>'
+ '</ul>'
+ '<div class="clearing"></div>'
+ '</div>'
+ '<div class="addApp_new editAppCon hidden">'
+ '</div>'
+ '</div>';
appRigth.append(tmpHtml);
$('.addApp_name').val('請輸入4~6個字元,支援中文,英文');
},'json');
// return false; h
});
}