0

I have already search for several websites through net. I still have the problem that: I choose window.load to execute the following code, but my blanket of height is always undefined.

<!DOCTYPE html> 
<html>
   <head>
      <title>Tobyliao</title>
      <script src="jquery-3.2.1.min.js" type="text/javascript"></script>
      <script type="text/javascript"> // $(window).on('load', function() { ... }); $(document).ready(function(){ // $('#div1').html('Height='+$('img1').height()+'Width='+$(img1‌​).width()); }); $(window).on("load", function(){ $('#div1').html('Height='+$('img1').height()+'<br/>'+'Wid‌​th='+$(img1).width()‌​); }); </script> 
      <div id="div1"></div>
      <img src="microsd.jpg" id="img1"> 
   </head>
   <body> </body>
</html>
Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62
  • Tobyliao – Tobyliao Apr 28 '17 at 04:50

1 Answers1

0

Looking at the JQuery API docs it looks like their example shows the syntax as:

$( window ).load(function() {
  // Run code
});
SupposedlySam
  • 675
  • 5
  • 14