Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <script type="text/javascript" src="file1.js"></script>
  2. <script type="text/javascript" src="file2.js"></script>
  3.  
  4. function primary()
  5. {
  6. secondary();
  7. }
  8.  
  9. function secondary()
  10. {
  11. alert("hi primary");
  12. }
  13.  
  14. <html>
  15. <head>
  16. <script src=script1.js></script>
  17. <script src=script2.js></script>
  18. </head>
  19. <body>
  20. </body>
  21. </html>
  22.  
  23. secondary();
  24.  
  25. secondary();
  26.  
  27. <html>
  28. <head>
  29. <script src=script1.js defer></script>
  30. <script src=script2.js></script>
  31. </head>
  32. <body>
  33. </body>
  34. </html>
  35.  
  36. $.getScript("file1.js",function(){
  37.  
  38. alert("File1.js is loaded");
  39. }
  40.  
  41. File1 = function(){
  42. }
  43. File1.prototype=
  44. {
  45. constructor:File1,
  46. primary:function()
  47. {
  48. if (File2 == "undefined")
  49. {
  50. $.getScript("file2.js",function()
  51. {
  52. file2 = new File2();
  53. file2.secondary();
  54. });
  55. }
  56. }
  57. }
  58.  
  59. File2 = function(){
  60. }
  61. File2.prototype=
  62. {
  63. constructor:File2,
  64. secondary:function()
  65. {
  66. if (File1 == "undefined")
  67. {
  68. $.getScript("file1.js",functiom()
  69. {
  70. file1 = new File1();
  71. file1.primary();
  72. });
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement