Duvida no uso onload="init();"

0 respostas
P

Olá,

estou duvida como fazer na hora body pra verificar init()
está me dando erro e não manjo muito de javascript…

erro :

Linha 11
caractere:8
Erro: ‘document.form.temporario’ é nulo ou não é um objeto

pois quando essa página for chamada de outra pagina pode passar o
valor de campo ou não por isso queria verificar seu conteudo …

alguém poderia me ajudar ???

<html>
  
  <head>
  
  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
  	<META HTTP-EQUIV="EXPIRES" CONTENT="-1">
  <script type="text/javascript">
  
      function init() {
  
         if(document.form.temporario.value.trim()==""){
            document.getElementById( 'detalhes' ).src = 'index6.html';
         }else{
            document.getElementById( 'detalhes' ).src = 'index5.html';
         }
  
  
      }
  
  
  
     function temp(obj) {
     //alert("passo1");
         if(obj.checked == true){
           document.getElementById( 'detalhes' ).src = 'index6.html';
         }else{
           document.getElementById( 'detalhes' ).src = 'index5.html';
  
         }
     }
  </script >
  
  
  </head>
  
    <body onload="init();">
  
      <form name="form>
  
  	  <table width="530" border="0" cellspacing="0" cellpadding="0" class="texto">
          <tr>
            <td width="136" align="right">*Temporário:</td>
  		  <td width="4" > </td>
            <td width="390" align="left">
  
              <input type="checkbox" id="temporario" name="temporario" value="0" onClick="temp(form.temporario)">
  
              </td>
          </tr>
        </table>
  
     </form>
  
   <body>
  
   <IFRAME src="index5.html" frameborder="0"  WIDTH="100%" height="400" SCROLLING="no" name="detalhes2" style="border: 0px solid #6896A5;" id="detalhes"> </IFRAME>
</html>
Criado 28 de agosto de 2009
Respostas 0
Participantes 1