htmlgroup.js

来自「一个页面界面的邮件程序」· JavaScript 代码 · 共 51 行

JS
51
字号
/* * GContact / PAUL Grégory * * In this file are functions relative to groups to update the view (html) */ /* * Show a form to update groups (and, by the way, update the group list zone) * @param Groups list, formated in XML */function showGroupMgtForm(resultXML) {	var content = document.getElementById("content"),		listeGroupes = document.getElementById("listeGroupes"),		tmpListeGroupes = '';	if (resultXML) {		content.innerHTML = "";		listeGroupes.innerHTML = "";				var groups = resultXML.getElementsByTagName("groups")[0];				for (var i = 0; i < groups.childNodes.length; i++) {			var id = groups.childNodes[i].getAttribute("id");			var canBeDeleted = (groups.childNodes[i].getAttribute("canBeDeleted") == 'true') ? true : false;			var nbPerson = groups.childNodes[i].getAttribute("nbPerson"), txtPerson = '', deleteButton = '';			if (nbPerson.length == 0) {				nbPerson = '0';				txtPerson = lbl_nobody;				deleteButton = "<input type='button' name='delete"+ id +"' value='"+ action_delete +"' onclick='deleteGroup("+ id +");'/>";			} else				txtPerson = '('+ nbPerson +' '+ ((nbPerson > 1) ? lbl_persons : lbl_person) +')';						content.innerHTML += '<label for="name'+id+'">'+ lbl_group_name +'&nbsp;:&nbsp;</label><input type="text" name="name'+id+'" id="name'+id+'" value="'+groups.childNodes[i].getAttribute("name")+'" maxlength="16"/>&nbsp;*&nbsp;'+ deleteButton +'&nbsp;'+ txtPerson +'<br/>';			listeGroupes.innerHTML += '<li><a href="#" onclick="showGroup('+ id +');">'+ groups.childNodes[i].getAttribute("name") +'</a>&nbsp;('+ nbPerson +')</li>';		}		content.innerHTML = '<form name="formGroup" id="formGroup" method="post" action="#">' +							'<fieldset><legend>'+ lbl_group_title +'</legend>' +							content.innerHTML +							'<input type="button" class="marginButtons" value="'+ action_update_group +'" onclick="modifyGroupNames()"/><br/>' + 							'<hr/>' +							'<label for="name">'+ lbl_group_name +'&nbsp;:&nbsp;</label><input type="text" name="nameNew" id="nameNew" value="" maxlength="16"/>&nbsp;*&nbsp;' +							'<input type="button" name="new" value="'+ action_create +'" onclick="createGroupName(document.getElementById(\'nameNew\'))"/>' +							'</fieldset>' +								'</form>' + msgRequired;				listeGroupes.innerHTML = '<ul>' + listeGroupes.innerHTML + '</ul>';	} else		content.innerHTML = problemXmlResult;	return true;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?