Uso uma função Javascript para adicionar options em um select. No Chrome funciona normal, mas no Firefox por uma fração de segundo vejo que a option foi adicionada, mas o navegador navega para uma página com o HTML abaixo, impedindo que continue utilizando a página.
<html>
<head></head>
<body>
false
</body>
</html>
Segue o código da minha função e a chamada:
function addOption(fonte, destino) {
select1 = document.getElementById(fonte);
select2 = document.getElementById(destino);
if (select1.options.length > 0 && select1.selectedIndex != -1) {
// adiciona todos os elementos selecionados do select1
// para o select2
while (select1.selectedIndex != -1) {
var selectedIndex = select1.selectedIndex;
var listText = select1.options[selectedIndex].text; // ome(name) do
// Elemento
var listValue = select1.options[selectedIndex].value;
var listTitle = select1.options[selectedIndex].title;
// Verifica se o elemento selecionado já foi adicionado anteriomente
for (k = 0; k < select2.options.length; k++) {
if (select2.options[k].value == listValue) {
// select1.options[selectedIndex] = null;
return true;
}
}
// envia o elemento do select1 para o 2
select2.options[select2.options.length] = new Option(listText,
listValue);
select2.options[select2.options.length - 1].title = listTitle;
select1.options[selectedIndex].selected = false;
}
}
return false;
}
<a href="javascript:addOption('epesqregular', 'pesqgrupo')">
<img src="../swf/insere.GIF" border="0" alt="inserir" title="Inserir" />
</a>