![]() |
Is there a way to changean image's display dimentions in javascript?
I'm trying to mod the Weather widget that comes with Konfabulator, and the current method that is used is there are two sizes of each image. For the small images, the small version is called. What I want to do is elimiate this method, and call the large image, and resize it.
Is there a javascript method to do this? I tried .width=10; and .height=10; and it yelled @ me. /edit an example of the code I'm working with code: I googled but all I can fine is how to get the dimentions. Nothing in setting them. |
You can't resize the image with javascript. You can display it at a smaller size, but you still have to load the full image.
.width and .height should work fine. img.style.width='20px'; img.style.height='20px'; |
I don't mind loading the whole image, as it is just for a small application on my desktop, not for a site. I'll try .style.width=XX; and see what happens.
|
The .style properties change the CSS attributes of the object. I'm not sure if that scales images, but I think it does.
|
What's wrong with width and height attributes from <img>....?
After all, the end-user will see the re-sized image. |
Actually, you could probably use the setAttribute() DOM method to set the "width" and "height" things, yeah.
|
I'm still gettign yelled at, so idk....I give up.
|
1 Attachment(s)
forgot to attach :p change the filetype from .txt to .js after download, if anyone takes the time.
|
| All times are GMT. The time now is 10:09. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.