469,936 Members | 2,487 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

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
Jul 20 '05 #1
2 8026
Frederik S wrote on 15 nov 2003 in comp.lang.javascript:
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?


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)
Jul 20 '05 #2
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
http://www.eclecticacademy.com

"Frederik S" <tr***********@hotmail.com> wrote in message
news:3f**********************@dread14.news.tele.dk ...
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

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Don Stefani | last post: by
2 posts views Thread by skubik | last post: by
12 posts views Thread by enak | last post: by
2 posts views Thread by DaWoE | last post: by
3 posts views Thread by lcjohnso | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.