New Image Size

Javascript coding ..

Moderators: macek, egami, gesf

User avatar
popeye
New php-forum User
New php-forum User
Posts: 120
Joined: Sat Jan 03, 2004 7:06 pm
Location: New York, NY

New Image Size

Postby popeye » Thu May 17, 2007 12:39 pm

I have a little code like the following:

Code: Select all

<script language='JavaScript' type='text/javascript'>
function ReplaceImage(alt_image,Pic_X,Pic_Y){
OutPic = new Image(Pic_X,Pic_Y);
OutPic.src=alt_image;
document.i_ImgName.src=OutPic.src;
}
</script>


and than some HTML like this:

Code: Select all

<img src='picofweek.jpg' alt='Picture of the Week' Width='PicX' Height='PicY' align='right' name='i_ImgName' border='1'>
<img src='thumnail1.jpg'  border='0' onClick="ReplaceImage('realpicture1.jpg',Pic1X,Pic1Y)">
<img src='thumnail2.jpg'  border='0' onClick="ReplaceImage('realpicture2.jpg',Pic2X,Pic2Y)">


The replaced pictures never takes the X and Y sizes of the realpictures. It always defaults to the size of 'picofweek.jpg' and therefore sometimes have unbalanced resolution. :?
I appreciate any suggestions.

Thanks

Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 1 guest

cron