...

View Full Version : change action attribute of form



sugeet_s
08-29-2006, 07:37 PM
hi,
Can any one tell how to change action attribute in form tag using javascript.

thanks in advance

regards
sugeet:thumbsup:

Kor
08-29-2006, 08:56 PM
document.forms['formname'].action='whichever.php'

LearningCoder
01-05-2011, 10:48 PM
How do you use the action attribute with a clock?

Getting a validation error.:(

Philip M
01-06-2011, 08:06 AM
How do you use the action attribute with a clock?

Getting a validation error.:(

What on earth does that mean? :confused:

LearningCoder
01-06-2011, 08:14 PM
Well for instance, I only have one error left on my page and this is it:

1. Error Line 259, Column 19: required attribute "action" not specified

<form name="clock">



The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.


So it's saying i've left out an attribute for the above element???

I've tried a few things but getting nowhere (btw-very new to javascript). :D

Philip M
01-06-2011, 08:39 PM
Try <form name = "clock" action = "">

and then in script as Kor proposes

document.forms['clock'].action = 'whichever.php' // the new action

Note that the form must exist in your page before the scrpt is called.

Why do you want to do this in any event?

LearningCoder
01-06-2011, 08:51 PM
Thank you I will get to work on that!

I'm just playing around at the moment with various JavaScripts'. Like I said it's all very new to me and i'm finding it very hard, whereas the HTML and CSS came natural. Although I have not got any books on JS whereas I have with HTML + CSS. Got a few on order though from Waterstones so they should be arriving shortly canny wait!

Although there is various sites explaining JavaScript, you still can't beat a good old fashioned book!


Thanks for all the feedback



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum