Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5.  
  6. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" />
  7.  
  8. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  9. </head>
  10. <body>
  11. <div id="output"></div>
  12.  
  13.  
  14. <script type="text/javascript">
  15. var functionCreate = function(intWidth, intHeight) {
  16.  
  17. $('<table></table>').attr('border', '1');
  18. $('<table></table>').append('<tr></tr');
  19. //$.each(intHeight, function(intHeight, r) {
  20. // var row = $('<tr></tr>');
  21. // $.each(intHeight, function(intHeight, r) {
  22.  
  23. //});
  24. //});
  25. //var data = $('<td></td>');
  26.  
  27. // create a table with the width and height and in doing so, set the text to each cell / td element to 'y.x' (see example below)
  28. // remember that you were already asked to create a table in the javascript section, but here you are asked to return a jquery object that represents a table
  29. // to do this, you will have create jquery elements that represent the tr / td elements and append them systematically to a jquery table element
  30.  
  31.  
  32. return jQuery('<table></table>');
  33.  
  34. };
  35.  
  36. jQuery('#output')
  37. .append(functionCreate(3, 2))
  38. ;
  39.  
  40. // expected table for functionCreate(2, 1):
  41. // <table border="1">
  42. // <tr>
  43. // <td>1.1</td>
  44. // <td>1.2</td>
  45. // </tr>
  46. // </table>
  47.  
  48. // expected table for functionCreate(3, 2):
  49. // <table border="1">
  50. // <tr>
  51. // <td>1.1</td>
  52. // <td>1.2</td>
  53. // <td>1.3</td>
  54. // </tr>
  55. // <tr>
  56. // <td>2.1</td>
  57. // <td>2.2</td>
  58. // <td>2.3</td>
  59. // </tr>
  60. // </table>
  61. </script>
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement