Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <style type="text/css">
  7. .redbox
  8. {
  9. background-color:#F00;
  10. border:thin solid #C90;
  11. width: 50px;
  12. height:50px;
  13.  
  14. }
  15. .grnbox
  16. {
  17. background-color:#0F0;
  18. border:thin solid #C90;
  19. width: 50px;
  20. height:50px;
  21.  
  22. }
  23.  
  24.  
  25. </style>
  26. <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
  27. <script language="javascript">
  28. k=0;
  29. $(function()
  30. {
  31. $(".redbox").click(function(e) {
  32. if(k%2 == 0)
  33. {
  34. $("#container").append("<div class='grnbox'>&nbsp;</div>");
  35. alert($(".grnbox").length + " green");
  36. }
  37. else
  38. {
  39. $("#container").append("<div class='redbox'>&nbsp;</div>");
  40. alert($(".grnbox").length + " red");
  41. }
  42. k++;
  43. });
  44.  
  45.  
  46. $(".grnbox").on('click',function() {
  47. alert($(".grnbox").length + " green");
  48. return true;
  49. });
  50. });
  51.  
  52.  
  53.  
  54. </script>
  55. </head>
  56. <html>
  57. <body>
  58. <div id="container"><div class = "redbox"></div> </div>
  59. </body>
  60. </html>
  61.  
  62. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  63. <html xmlns="http://www.w3.org/1999/xhtml">
  64. <head>
  65. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  66. <title>Untitled Document</title>
  67. <style type="text/css">
  68. .redbox
  69. {
  70. background-color:#F00;
  71. border:thin solid #C90;
  72. width: 50px;
  73. height:50px;
  74.  
  75. }
  76. .grnbox
  77. {
  78. background-color:#0F0;
  79. border:thin solid #C90;
  80. width: 50px;
  81. height:50px;
  82.  
  83. }
  84.  
  85.  
  86. </style>
  87. <script type="text/javascript" src="js/jquery-1.10.2.js"></script>
  88. <script language="javascript">
  89. k=0;
  90. $(function()
  91. {
  92. $(".redbox").click(function(e) {
  93. if(k%2 == 0)
  94. {
  95. $("#container").append("<div class='grnbox'>&nbsp;</div>");
  96. }
  97. else
  98. {
  99. $("#container").append("<div class='redbox'>&nbsp;</div>");
  100. }
  101. k++;
  102. });
  103.  
  104.  
  105. $(".grnbox").on('click',function() {
  106. alert($(".grnbox").length + " green");
  107. return true;
  108. });
  109. });
  110.  
  111.  
  112.  
  113. </script>
  114.  
  115. </head>
  116.  
  117. <body>
  118.  
  119. <div id="container"><div class = "redbox"></div> </div>
  120. </body>
  121. </html>
  122.  
  123. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  124. <html xmlns="http://www.w3.org/1999/xhtml">
  125. <head>
  126. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  127. <title>Untitled Document</title>
  128. <style type="text/css">
  129. .redbox
  130. {
  131. background-color:#F00;
  132. border:thin solid #C90;
  133. width: 50px;
  134. height:50px;
  135.  
  136. }
  137. .grnbox
  138. {
  139. background-color:#0F0;
  140. border:thin solid #C90;
  141. width: 50px;
  142. height:50px;
  143.  
  144. }
  145.  
  146.  
  147. </style>
  148. <script type="text/javascript" src="js/jquery-1.10.2.js"></script>
  149. <script language="javascript">
  150. k=0;
  151. $(function()
  152. {
  153. $(".redbox").click(function(e) {
  154. if(k%2 == 0)
  155. {
  156. $("#container").append("<div class='grnbox'>&nbsp;</div>");
  157. }
  158. else
  159. {
  160. $("#container").append("<div class='redbox'>&nbsp;</div>");
  161. }
  162. k++;
  163. });
  164.  
  165.  
  166. $("#container").on('click',".grnbox",function() {
  167. alert($(".grnbox").length + " green");
  168. return true;
  169. });
  170. $("#container").on('click',".redbox",function() {
  171. alert($(".redbox").length + " red");
  172. return true;
  173. });
  174.  
  175. });
  176.  
  177.  
  178.  
  179. </script>
  180.  
  181. </head>
  182.  
  183. <body>
  184.  
  185. <div id="container"><div class = "redbox"></div> </div>
  186. </body>
  187. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement