creating a form using Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Frederik S

    creating a form using Javascript

    Hello,

    I'm making a nice little login box in Javascript but having problems Posting
    the value inside a textfield.
    In a nutshell:

    I have a function:

    function getPostData (value)

    Which correctly gets the value, but how do I then create a form and submits
    inside Javascript?

    Help much appreciated,

    Frederik Sunne


  • Evertjan.

    #2
    Re: creating a form using Javascript

    Frederik S wrote on 15 nov 2003 in comp.lang.javas cript:
    [color=blue]
    > I'm making a nice little login box in Javascript but having problems
    > Posting the value inside a textfield.
    > In a nutshell:
    >
    > I have a function:
    >
    > function getPostData (value)
    >
    > Which correctly gets the value, but how do I then create a form and
    > submits inside Javascript?
    >[/color]

    A form is HTML, so you cannot make a form inside javascript.
    What you can do is have javascript make the HTML for you.
    What you can do is javascript submit the HTML form
    with a onclick="submit ()".

    It is very unclear what getPostData() does if you do not show the function
    script and what "value" should contain.

    Please show us and explain what you want to do.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Charlene Russ

      #3
      Re: creating a form using Javascript

      Mr. Evertjan is right, Forms are created by using HTML tags. You may
      however define functions that relate to the form withing JavaScript tags.
      Inside the script tags are where you declare your javascript variables,
      assign objects and declare functions. Using Event handlers withing the HTML
      form such as onClick you may call your functions.

      An example might be:

      <form name="myform">

      <input type="button" name="Button1" value="Vector 1"
      onClick="swap1( );">
      <input type="button" name="Button2" value="Vector 2"
      onClick="swap2( );">
      <input type="button" name="Button3" value="Vector 3"
      onClick="swap3( );" >
      <input type="button" name="Button4" value="Vector 4"
      onClick="swap4( );" >
      </form>

      Good luck,

      -Charlene
      Intro. JavaScript
      Get full access to this domain. Easy, seamless transactions. Zero percent financing available.


      "Frederik S" <trunte_trunte@ hotmail.com> wrote in message
      news:3fb602d4$0 $9732$edfadb0f@ dread14.news.te le.dk...[color=blue]
      > Hello,
      >
      > I'm making a nice little login box in Javascript but having problems[/color]
      Posting[color=blue]
      > the value inside a textfield.
      > In a nutshell:
      >
      > I have a function:
      >
      > function getPostData (value)
      >
      > Which correctly gets the value, but how do I then create a form and[/color]
      submits[color=blue]
      > inside Javascript?
      >
      > Help much appreciated,
      >
      > Frederik Sunne
      >
      >[/color]


      Comment

      Working...