Re: Javascript Style Properties for Dynamic Images in Safari
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Javascript Style Properties for Dynamic Images in Safari

From: RobG <rgqld@iinet.net.au>
Date: Fri Mar 31 2006 - 15:03:59 CEST

Joe Cox wrote:
> I am having a problem with style properties for dynamic images in Mac OS X
> Safari. By dymanic images, I mean images allocated with the javascript 'new
> Image()' call.

new Image() is not W3C DOM compliant, though I guess it's DOM 0. It seems
Safari creates an image object, but errors when you try to do anything with
it. Use W3C document.createElement() instead.

[...]

> function makeImgs(){
> var container1 = document.getElementById('cont1');
> var container2 = document.getElementById('cont2');
> var img1 = new Image(150,130);

Replace with:

   var img1 = document.createElement('img');
   img1.style.height = '150px';
   img1.style.width = '130px';

> var img2 = new Image(150,130);

Replace as above with createElement().

[...]

-- 
Rob
Received on Mon May 1 04:34:05 2006