O código é apenas para referência.
A cópia do código é a seguinte:
// consulta os dados do banco de dados que atendem aos critérios
Função SelectAlternativevenues (campo)
{
var xmlhttp;
var pid = document.getElementById ("nameandddress").
var url = "$ {retrieveurl}? accessortype = $ {accessortype}";
url = url+"& método = recuperado e nameanddress ="+escape (pid);
if (window.xmlhttprequest)
{
xmlHttp = new XmlHttPrequest ();
}
else if (window.activexObject)
{
xmlHttp = new ActiveXObject ("Microsoft.xmlHttp");
}
if (xmlhttp! = null)
{
xmlhttp.open ("get", url, true);
xmlHttp.setRequestHeader ("se modificado-s-gente", "0");
xmlhttp.send (nulo);
xmlhttp.onreadystatechange = function ProcessRefreshusers () // Método de registro
{
if (xmlhttp.readyState == 4)
{
if (xmlhttp.status == 200)
{
// Responsexml Obtém o valor de retorno do método de recuperação do método provinceide executado
var dados = xmlHttp.Responsexml.documentElement.getElementsByTagName ("AlternativeVenues");
var nname = document.getElementById ("Tabela1");
var pchildren = nname.childnodes; // limpe as linhas e colunas na tabela
for (var a = 0; a <pchildren.length; a ++)
{
nname.RemoVechild (pchildren [a]);
}
// Adicione a linha de consulta
var aarow = nname.insertrow (0);
var aacell = aarow.insertCell (0);
aacell.innerhtml = "<input type = 'text' name = 'nameanddress' id = 'nameanddress'/>";
aarow.insertcell (1) .innerhtml = "<estilo span =/" cursor: ponteiro; borda: 1px/"nome =/" submmit/"onclick =/" selectAlternativevenues ('""+field+"');/"> consulta </span> ";
// Adicione uma linha de título
var arow = nname.insertrow (1);
arow.insertCell (0) .innerhtml = "";
arow.insertCell (1) .innerhtml = "nome";
arow.insertCell (2) .innerhtml = "endereço";
arow.insertCell (3) .innerhtml = "Telectrônico";
// loop adiciona linhas de dados
for (i = 0; i <datas.length; i ++)
{
var id = dados [i] .getElementsByTagName ("id") [0] .FirstChild.NodEvalue;
var name = dados [i] .getElementsByTagName ("nome") [0] .FirstChild.NodEvalue;
var endereço = dados [i] .getElementsByTagName ("endereço") [0] .FirstChild.NodEvalue;
var telefone = dados [i] .getElementsByTagName ("telefone") [0] .FirstChild.NodEvalue;
var anewrow = nname.insertrow (i+2);
Anewrow.insertcell (0) .innerhtml = "<Tipo de entrada =/" Caixa de seleção/"Id =/" AlternativeVenues _ "+id+"/"nome =/" alternativoVenues _ "+id+"/"onclick =/" addRowSelectAfter ('alternativo +Id+"','"+field+"') /" /> ";
Anewrow.insertCell (1) .innerhtml = nome;
Anewrow.insertCell (2) .innerhtml = endereço;
Anewrow.insertCell (3) .innerhtml = telefone;
}
}
}
}
}
}
// Adicione dados selecionados
função addRowsElectAfter (id, campo)
{
// Divida todos
Var State = False;
var _hiddenId = document.getElementById (campo) .Value.substr (0, document.getElementById (campo) .Value.Length-1) .split (',');
for (j = 0; j <_hiddenId.length; j ++)
{
if (_hiddenId [j] == id.split ('_') [1])
{
estado = true;
}
}
if (estado == false)
{
// Basta clicar na caixa de seleção e começar a alterar o valor do domínio oculto uma vez
// Estado não selecionado requer remoção de identificação do controle oculto
var Arrrs = document.getElementById (campo) .Value.substr (0, document.getElementById (campo) .Value.Length-1) .split (',');
// Defina um campo para se acertar novamente
var newids = "";
for (var arr = 0; arr <arhs.length; arr ++)
{
if (arrs [arr]! = id.split ('_') [1])
newids+= arrs [arr]+",";
}
// atribui o controle oculto novamente
// o último personagem pode ser,
var fh = newids.substr (newids.length-1, newids.length);
if (fh == ",")
document.getElementById (campo) .Value = newids.substr (0, newids.length-1);
outro
document.getElementById (campo) .Value = newids;
if (document.getElementById (id) .Checked == false)
{
// Clique para alterar para o status não de ponto para remover locais selecionados
document.getElementById (id) .CHecked = false;
// Defina o ID para TR para excluir TR
document.getElementById ("Tabela2"). Deleterow (document.getElementById ("newrow _"+id.split ('_') [1]). rowindex);
}
outro
{
document.getElementById (id) .Checked = true;
var input = document.getElementById (campo);
var xmlhttp;
var url = "$ {retrieveurl}? accessortype = $ {accessortype}";
url = url+"& método = SELECTRESULT & id ="+id;
if (window.xmlhttprequest)
{
xmlHttp = new XmlHttPrequest ();
}
else if (window.activexObject)
{
xmlHttp = new ActiveXObject ("Microsoft.xmlHttp");
}
if (xmlhttp! = null)
{
xmlhttp.open ("get", url, true);
xmlHttp.setRequestHeader ("se modificado-s-gente", "0");
xmlhttp.send (nulo);
xmlhttp.onreadystatechange = function ProcessRefreshusers () // Método de registro
{
if (xmlhttp.readyState == 4)
{
if (xmlhttp.status == 200)
{
// Responsexml Obtém o valor de retorno do método de recuperação do método provinceide executado
var dados = xmlHttp.Responsexml.documentElement.getElementsByTagName ("AlternativeVenues");
var nname = document.getElementById ("Tabela2");
nname.style.width = "560px";
if (nname.rows.length == 0 && datas.length> 0)
{
// A primeira linha
var firststrow = nname.insertrow (0);
firstrow.id = "newrow_0";
Firstrow.insertCell (0) .innerhtml = "nome";
Firstrow.InsertCell (1) .innerhtml = "endereço";
Firstrow.InsertCell (2) .innerhtml = "Telectrônico";
Firstrow.InsertCell (3) .innerhtml = "Operação";
}
for (i = 0; i <datas.length; i ++)
{
var id = dados [i] .getElementsByTagName ("id") [0] .FirstChild.NodEvalue;
var name = dados [i] .getElementsByTagName ("nome") [0] .FirstChild.NodEvalue;
var endereço = dados [i] .getElementsByTagName ("endereço") [0] .FirstChild.NodEvalue;
var telefone = dados [i] .getElementsByTagName ("telefone") [0] .FirstChild.NodEvalue;
var anewrow = nname.insertrow (nname.rows.length);
Anewrow.id = "newrow _"+id;
var oneCell = Anewrow.insertCell (0);
oneCell.innerhtml = nome;
OneCell.Width = 140;
var Twocell = Anewrow.insertCell (1);
twocell.innerhtml = endereço;
twocell.width = 280;
var theCell = Anewrow.insertCell (2);
threecell.innerhtml = telefone;
Threecell.width = 100;
var FourCell = Anewrow.insertCell (3);
quatrocell.innerhtml = "<span id =/" span _ "+id+"/"onclick =/" deleterow ('""+id+"', this, '"+field+"')/"> delete </span> ";
FourCell.Width = 40;
if (input.value! = "")
input.value+= ",";
input.value+= id;
}
}
}
}
}
}
}
}
função deleterow (id, obj, campo)
{
obj.parentnode.parentnode.parentnode.removechild (obj.parentnode.parentnode)
var nname = document.getElementById ("Tabela2");
if (nname.rows.length == 1)
{
nname.deleterow (0);
}
// Uma situação na lista acima após a consulta ter sido armazenada no banco de dados
if (document.getElementById ("AlternativeVenues _"+id)! = null || document.getElementById ("Alternativevenues _"+id)! = indefinido)
{
if (document.getElementById ("AlternativeVenues _"+id) .Checked == true)
{
document.getElementById ("AlternativeVenues _"+id) .Checked = false;
}
}
// Estado não selecionado requer remoção de identificação do controle oculto
var Arrrs = document.getElementById (campo) .Value.substr (0, document.getElementById (campo) .Value.Length-1) .split (',');
// Defina um campo para se acertar novamente
var newids = "";
for (var arr = 0; arr <arhs.length; arr ++)
{
if (ars [arr]! = id)
newids+= arrs [arr]+",";
}
// atribui o controle oculto novamente
// atribui o controle oculto novamente
// o último personagem pode ser,
var fh = newids.substr (newids.length-1, newids.length);
if (fh == ",")
{
document.getElementById (campo) .Value = newids.substr (0, newids.length-1);
}
outro
document.getElementById (campo) .Value = newids;
}