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

Untitled

By: a guest on Apr 17th, 2012  |  syntax: None  |  size: 2.32 KB  |  hits: 10  |  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. Cannot set/ read property of undefined
  2. var panel = "";
  3. var colorType = "texts";
  4. var interfaces = new Array();
  5. interfaces.push(new Interface());
  6. var colors = 'black'
  7. var idx = 0;
  8.  
  9. var interfaces = new Array();
  10.  
  11. function Interface(c)
  12. {
  13.     this.colors = c;
  14. }
  15. function changeColor()
  16. {
  17.     if(panel != '')
  18.     {
  19.         if(colorType == 'texts')
  20.         {
  21.             document.getElementById(panel).style.color = interfaces[idx].colors;
  22.         }
  23.         if(colorType == 'background')
  24.         {
  25.             document.getElementById(panel).style.backgroundColor = interfaces[idx].colors;
  26.         }
  27.     }
  28. }
  29. function changeSize()
  30. {
  31.     document.getElementById(panel).style.fontSize = interfaces[idx].getElementById('fsizes').value +'px';
  32. }
  33. function panelClicked()
  34. {
  35.     document.getElementById('texts').style.borderStyle = 'solid';
  36.     document.getElementById('background').style.borderStyle = 'none';
  37.     colors = 'black';
  38.     colorType = 'texts';
  39.     changeColor();
  40. }
  41.        
  42. <table style = "width:90px;">
  43.             <tr>
  44.                 <td class = 'colors' style = "background-color:red;" onclick = "interfaces[idx].colors = 'red'; changeColor();"></td>
  45.                 <td class = 'colors' style = "background-color:orange;" onclick = "interfaces[idx].colors = 'orange'; changeColor();"></td>
  46.                 <td class = 'colors' style = "background-color:yellow;" onclick = "interfaces[idx].colors = 'yellow'; changeColor();"></td>
  47.             </tr>
  48.             <tr>
  49.                 <td class = 'colors' style = "background-color:green;" onclick = "interfaces[idx].colors = 'green'; changeColor();"></td>
  50.                 <td class = 'colors' style = "background-color:blue;" onclick = "interfaces[idx].colors = 'blue'; changeColor();"></td>
  51.                 <td class = 'colors' style = "background-color:purple;" onclick = "interfaces[idx].colors = 'purple'; changeColor();"></td>
  52.             </tr>
  53.             <tr>
  54.                 <td class = 'colors' style = "background-color:lightpink;" onclick = "interfaces[idx].colors = 'lightpink '; changeColor();"></td>
  55.                 <td class = 'colors' style = "background-color:thistle;" onclick = "interfaces[idx].colors = 'thistle'; changeColor();"></td>
  56.                 <td class = 'colors' style = "background-color:black;" onclick = "interfaces[idx].colors = 'black'; changeColor();"></td>
  57.             </tr>
  58.         </table>