Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Assignment 3</title>
  6. </head>
  7. <h1>Assignment 3</h1>
  8. <h3>Select Course</h3>
  9. <select id = "text" size = "1">
  10.  
  11. <option value = "heading">Web Design 1</option>
  12. <option value = "heading2">Web Design 2</option>
  13. <option value = "heading3">Digital Art & Design</option>
  14. <option value = "heading4">Photography</option>
  15.  
  16. </select>
  17. <h1 id = "heading">Initial heading</h1>
  18. <p id = "content">Initial Content</p>
  19. <script src = "changeProgramInfo.js"></script>
  20. <body>
  21. </body>
  22. </html>
  23.  
  24. document.getElementById('text').onchange = function() {
  25. var text =
  26. document.getElementById('text').selectedIndex;
  27. document.body.style.backgroundText =
  28. document.getElementById('text').options[text].value
  29. }
  30.  
  31. var pageContent = new Array();
  32.  
  33. pageContent[0] = {heading: "HEADING 1" ,
  34. content: "CONTENT 1"};
  35. pageContent[1] = {heading: "HEADING 2" ,
  36. content: "CONTENT 2"};
  37. pageContent[2] = {heading: "HEADING 3" ,
  38. content: "CONTENT 3"};
  39. pageContent[3] = {heading: "HEADING 4" ,
  40. content: "CONTENT 4"};
  41.  
  42. var index = 0;
  43. document.getElementById('text').onclick =function () {
  44.  
  45. document.getElementById('heading').textContent;
  46. pageContent[index].heading;
  47. document.getElementById('content').textContent =
  48. pageContent[index].content;
  49.  
  50. index++;
  51. index = index % pageContent.length;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement