Ashura: Bildbreite

Beitrag lesen

Hallo Siechfred.

function test_me() {

var url = document.Formular.bild.value;
  var img = new Image();
  img.onload = function() { alert(this.width+" x "+this.height); };
  img.onerror = function() { alert(this.src + " ist keine Grafikdatei!"); };
  img.src = url;
}

  
Bist du sicher, dass es nicht so aussehen müsste?  
  
~~~javascript
function test_me() {  
  var url = document.Formular.bild.value;  
  var img = new Image();  
  img.src = url;  
  img.onload = function() { alert(this.width+" x "+this.height); };  
  img.onerror = function() { alert(this.src + " ist keine Grafikdatei!"); };  
}

Auf wessen src, width und height sollte sonst zugegriffen werden?

Einen schönen Montag noch.

Gruß, Ashura

--
sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
„It is required that HTML be a common language between all platforms. This implies no device-specific markup, or anything which requires control over fonts or colors, for example. This is in keeping with the SGML ideal.“
[HTML Design Constraints: Logical Markup]