Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 1.15 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Multiple javascript buttons (Enable/Disable)
  2. // Left Menu function controls(className) {
  3. if (className == "red") {
  4.     document.getElementById('Skip').setAttribute('class','green');
  5.     // You can define your play music statements here
  6. } else {
  7.     document.getElementById('Skip').setAttribute('class','red');
  8.     // You can define your stop music statements here        
  9. } }
  10.  
  11. if (className == "red1") {
  12. document.getElementById('Text').setAttribute('class','green1');
  13. // You can define your play music statements here } else {
  14. document.getElementById('Text').setAttribute('class','red1');
  15. // You can define your stop music statements here         } }
  16.        
  17. .red {
  18. background: red;
  19. height: 30px;
  20. width: 30px;
  21. border-radius: 50px;
  22. border: 1px solid #000;}                                                                                              
  23.  
  24. .green {
  25. background: green;
  26. height: 30px;
  27. width: 30px;
  28. border-radius: 50px;
  29. border: 1px solid #000;}
  30.        
  31. Skip &nbsp; <button id="Skip" class="red" onclick="controls(this.getAttribute('class'))">Play</button>
  32.  
  33. Text &nbsp; <button id="Text" class="red1" onclick="controls(this.getAttribute('class'))">Play</button>