Mike a ecrit :
I need to be able to set EITHER document.imageName.width OR
document.imageName.height to a specific value and then have the other
property set to it's default. For instance, if I was going to
hard-code all these images, some would look like <img src=blah
width=100> and some would look like <img src=blah2
height=100>. How do I "leave off" the second sizing parameter from
javascript. I've tried width='', width=0, width=null - none of these
work as they make the image have zero width.
understood anything !
function resizeImage(img,width,height){
if(document.images){
i=document.images[img];
alert('image default width = '+i.width+
'\nimage default height = '+i.height);
if(width!='' && i.width!=width) i.width=width;
else
if(height!='' && i.height!=height) i.height=height;
}}
<img src="asm.gif" name="i04" width=50>
<img src="asm.gif" name="i02">
<p><a href="javascript
:resizeImage('i04',500,'');">exo 1</a>
<p><a href="javascript
:resizeImage('i04','',150);">exo 2</a>
<p><a href="javascript
:resizeImage('i02','',50);">exo 3</a>
--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************