Calling Different Submit Button Classes with Javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adria
    New Member
    • Jan 2008
    • 2

    Calling Different Submit Button Classes with Javascript

    Is it possible to create a script that calls a different submit button class for a specific submit button in a form, whereas the rest of the buttons are another class?

    These are the two button classes:

    [CODE=css]<style type="text/css">

    }

    .FormSubmit{
    background-color: #8BD1FF;
    border: 0;
    margin-top:10px;
    padding:3px;
    font-family: arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight:bold;
    color:#FFFFFF;
    cursor:pointer;
    }

    .completebutton {
    background-color: "red";
    border: 0;
    margin-top:10px;
    padding:3px;
    font-family: arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight:bold;
    color:#FFFFFF;
    cursor:pointer;
    }

    </style>[/CODE]

    I want to use this code for the last button in the form but it's hard coded so I don't have acess to it.

    [HTML]<INPUT TYPE="Submit" NAME="submitFor m" VALUE="complete registration" CLASS="complete button">[/HTML]

    Is there a way to get use this class when I want to, replacing the .FormSubmit that is used throughout the rest of the form?
    Last edited by gits; Jan 24 '08, 07:04 PM. Reason: added code tags
  • CroCrew
    Recognized Expert Contributor
    • Jan 2008
    • 564

    #2
    Why can’t you just use buttons instead of submits?

    Example:

    Code:
    <input type="button" value="Click Me" class="FormSubmit" onclick="document.Form1.submit();">
    <input type="button" value="Click Me" class="completebutton" onclick="document.Form2.submit();">
    Last edited by CroCrew; Jan 24 '08, 08:14 PM. Reason: Changed the form name

    Comment

    • adria
      New Member
      • Jan 2008
      • 2

      #3
      Originally posted by CroCrew
      Why can’t you just use buttons instead of submits?

      Example:

      Code:
      <input type="button" value="Click Me" class="FormSubmit" onclick="document.Form2.submit();">
      <input type="button" value="Click Me" class="completebutton" onclick="document.Form2.submit();">

      I'm not sure if this will work because the submits are already hard coded in the application I am using.

      Comment

      • CroCrew
        Recognized Expert Contributor
        • Jan 2008
        • 564

        #4
        Originally posted by adria
        I'm not sure if this will work because the submits are already hard coded in the application I am using.

        Opps relook at my post. I made a change to the code.

        Comment

        • Logician
          New Member
          • Feb 2007
          • 210

          #5
          Originally posted by adria
          [HTML]<INPUT TYPE="Submit" NAME="submitFor m" VALUE="complete registration" CLASS="complete button">[/HTML]

          Is there a way to get use this class when I want to, replacing the .FormSubmit that is used throughout the rest of the form?
          Somewhere after the form is rendered:
          Code:
          document.forms.myForm.submitForm.className="completebutton";

          Comment

          Working...