Jump to content
Fórum Script Brasil
  • 0

Passar Valor Para Campo Input.


gius
 Share

Question

Olá Fórum,

no caso do vetor dinâmico já consegui resolver.

Grato.

Mas porque ao tentar passar um valor para um campo input ocorre o seguinte erro:

'document.formcad.numero é nulo ou não é um objeto' se a função tá ok?

<form name=formcad>

<input type=text name=numero value=''>

</form>

<form name=buttons>

<BUTTON name='num' onClick='funcao(" & IDD & ")'> botao </BUTTON>

</form>

funcao(variavel)

{

(...)

variavel = IDD

document.formcadastro.numero.value = variavel

}

Edited by gius
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Fiz um código baseado no que postou, com algumas modificações, tornando-o funcional.

Veja se concorda:

<html>

 <head>

  <script type="text/javascript">
  function f(variavel)
  {
      // (...)
      document.formcad.numero.value = variavel;
  }
  </script>

 </head>

 <body>

  <form name="formcad">
   <input type="text" name="numero" value="">
  </form>

  <form name="buttons">
   <button type="button" name="num" onClick="f(' & IDD & ');"> botao </button>
  </form>

 </body>

</html>

Edited by CSML sistemas
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...