By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,594 Members | 3,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,594 IT Pros & Developers. It's quick & easy.

Calling Different Submit Button Classes with Javascript

P: 2
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:

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2.  
  3. }
  4.  
  5. .FormSubmit{ 
  6. background-color: #8BD1FF; 
  7. border: 0; 
  8. margin-top:10px; 
  9. padding:3px; 
  10. font-family: arial, Helvetica, sans-serif; 
  11. font-size: 11px; 
  12. font-weight:bold; 
  13. color:#FFFFFF; 
  14. cursor:pointer; 
  15.  
  16. .completebutton{ 
  17. background-color: "red"; 
  18. border: 0; 
  19. margin-top:10px; 
  20. padding:3px; 
  21. font-family: arial, Helvetica, sans-serif; 
  22. font-size: 11px; 
  23. font-weight:bold; 
  24. color:#FFFFFF; 
  25. cursor:pointer; 
  26. }
  27.  
  28. </style>
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="submitForm" VALUE="complete registration" CLASS="completebutton">[/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?
Jan 24 '08 #1
Share this Question
Share on Google+
4 Replies


CroCrew
Expert 100+
P: 563
Why canít you just use buttons instead of submits?

Example:

Expand|Select|Wrap|Line Numbers
  1. <input type="button" value="Click Me" class="FormSubmit" onclick="document.Form1.submit();">
  2. <input type="button" value="Click Me" class="completebutton" onclick="document.Form2.submit();">
  3.  
Jan 24 '08 #2

P: 2
Why canít you just use buttons instead of submits?

Example:

Expand|Select|Wrap|Line Numbers
  1. <input type="button" value="Click Me" class="FormSubmit" onclick="document.Form2.submit();">
  2. <input type="button" value="Click Me" class="completebutton" onclick="document.Form2.submit();">
  3.  

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

CroCrew
Expert 100+
P: 563
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.
Jan 24 '08 #4

100+
P: 210
[HTML]<INPUT TYPE="Submit" NAME="submitForm" VALUE="complete registration" CLASS="completebutton">[/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:
Expand|Select|Wrap|Line Numbers
  1. document.forms.myForm.submitForm.className="completebutton";
Jan 25 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.