By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,183 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,183 IT Pros & Developers. It's quick & easy.

creating a form using Javascript

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.