|
-
May 19th, 2002, 04:24 AM
#1
Thread Starter
Hyperactive Member
submit form
<form name=kk action="file.php">
<input type=text name=kkk value="Hi">
</Form>
How can I submit this form auto. using JavaScript code?
-
May 19th, 2002, 07:41 AM
#2
Fanatic Member
I believe its document.kk.submit(); but I may be wrong
-
May 20th, 2002, 07:57 AM
#3
Junior Member
There are a couple ways you could do this. Depending on how you want the form to be submitted. If you want a button to be clicked to do it and that is all you have in the form just use a submit button:
<input type="submit" value="the text you want on the button">
If you have other things that you want to do with javascript then you can use an onClick event on a button or any other javascript event to call a function.
In the <head> section of your page, you will need to create the function:
<head>
<script language="javascript">
function submitForm() {
document.kk.submit()
}
</script>
</head>
Then you would call the function from a button or just about any other object that can use an onClick event, ie:
<input type="button" value"Submit or somthing" onClick="submitForm()">
This will call the function in the head section of your page. Also make sure that you use a method for your form. You can do this in the form tag. simply add a method="post" section to your form. If you wanted to use the javascript function you could also add it there by adding the following to the function before the submit:
document.kk.method = "post"
-Korendir
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|