Javascript examples for DOM HTML Element:Style
read img width set from css file
<!doctype html> <html> <head> <style> #slideshow img {//w w w . j a v a 2 s . co m display : block; border:1px solid; width : 300px; height : 200px; } </style> </head> <body> <div id="slideshow"> <img src="slides/1.gif"> <img src="slides/2.gif"> <img src="slides/3.gif"> </div> <script> window.onload = function () { console.log(document.getElementsByTagName('img')[0].clientWidth); } </script> </body> </html>