jQuery using width height functions

We have a table with images whose width and height is set to 100 from the beginning and two buttons that will determine by an alert the height of image 0 and the height of image 2.

  • We set the width of all images to 200 pixels.
  • We designate a variable my_width that will store the width of the first image and add 200 to it.
  • For image 2 we set the width of the variable my_width using the function width.
  • We designate two variables that obtain the height of the first image and the height of image 2.
  • We make use of the function click to detect when the buttons are clicked.
  • When we click on the button with id show_img0 we create a function that generates an alert that shows the height designated by the variable my_height_0.
  • When we click on the button with id show_img2 we create a function that generates an alert that shows the height designated by the variable my_height_2.
Comments

PHP Captcha


Interesting Articles