View Full Version : change action attribute of form

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

thanks in advance


08-29-2006, 09:56 PM

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

Getting a validation error.:(

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

Getting a validation error.:(

What on earth does that mean? :confused:

01-06-2011, 09: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, 09: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?

01-06-2011, 09: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