Witam, siemano.
Chciałem zapytac jak zrobic takie cos ze wklejam link do inputa po czym po nacisnieciu buttona wyskakuje alert() z wymiarami tego obrazka.
pozdrawiam,
Janusz Tracz
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <script type="text/javascript"> function getImgSize(id){ var pic = document.getElementById(id); var h = pic.offsetHeight; var w = pic.offsetWidth; alert ('The image size is '+w+'*'+h); } </script> </head> <body> <img id='demoImg' src="http://www.goldenstudy.com/bbs/uploadimg//20060228144500426.jpg"> <input type="button" onclick="getImgSize('demoImg')" value="Get Image Size"> </body> </html>
// JS function odczytaj(){ var link = document.getElementById('jakiesId').value; var img = '<img src="' + link + '">'; document.getElementById('prev').innerHTML = img; } // HTML