Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Apr 2006
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question change action attribute of form

    hi,
    Can any one tell how to change action attribute in form tag using javascript.

    thanks in advance

    regards
    sugeet

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    document.forms['formname'].action='whichever.php'
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder LearningCoder's Avatar
    Join Date
    Jan 2011
    Location
    The Pleiades
    Posts
    924
    Thanks
    76
    Thanked 29 Times in 29 Posts
    How do you use the action attribute with a clock?

    Getting a validation error.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,033
    Thanks
    203
    Thanked 2,539 Times in 2,517 Posts
    Quote Originally Posted by LearningCoder View Post
    How do you use the action attribute with a clock?

    Getting a validation error.
    What on earth does that mean?

  • #5
    Regular Coder LearningCoder's Avatar
    Join Date
    Jan 2011
    Location
    The Pleiades
    Posts
    924
    Thanks
    76
    Thanked 29 Times in 29 Posts
    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).
    Last edited by LearningCoder; 01-06-2011 at 08:17 PM. Reason: needed to as a question / typo

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,033
    Thanks
    203
    Thanked 2,539 Times in 2,517 Posts
    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?

  • #7
    Regular Coder LearningCoder's Avatar
    Join Date
    Jan 2011
    Location
    The Pleiades
    Posts
    924
    Thanks
    76
    Thanked 29 Times in 29 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •