I need some help with the code below:
<script type="text/javascript">
var opcao = new Array (
document.getElementById("cred_form_1864_1_wpcf-pde_Pesquisas_descontinuadas"),
document.getElementById("cred_form_1864_1_wpcf-pnps_Pesquisas_nao_patenteaveis-sigilosas")
);
function check1(){
if (opcao[0].checked == true){
for (var i = 0; i < opcao.length; i++){
if (i != 0){
opcao[i].checked = false;
opcao[i].disabled = true;
}
}
}
}
function check2(){
if (opcao[1].checked == true){
for (var i = 0; i < opcao.length; i++){
if (i != 1){
opcao[i].checked = false;
opcao[i].disabled = true;
}
}
}
}
</script>
I need to call the array 'opcao' within the functions 'check1 ()' and 'check2 ()'. How can I do this?
====================
I tried the suggestion of Mishik did not work. What I need is that the functions 'check1 ()' and 'check2 ()' to access the same array 'opcao'. If I write the array within each function the code works perfectly. But how are the same values I would have to repeat the same array for each function created.
id's like this<div id="header-banner-shows-visitors-of-latest-deals-in-september-this-year---bye"> <img src="..."/> </div>