The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

i wish it were that easy. I'm pretty sure js doesnt require semicolons, but I added them anyways and still no luck. I think it has to do with how I'm traversing the nodes in "node = rsRoot.childNodes[i]", does childNodes reference all children and their children or just the children of that node?

I'm guessing you've already dealt with this... but just not to overlook the obvious.

If I read this right, you're creating a half size preview by resizing a full image? At that point you've already made the visitor download the whole image so why bother with a preview? Why can't they just have the whole thing?

Whatever you can do or dream you can, begin it.
Boldness has genius, power and magic in it. Begin it now. Chroniclemaster1, Founder of Earth ChronicleA Growing History of our Planet, by our Planet, for our Planet.

Well, this "preview" is on a rollover event and the full size image is taking up half the screen on lower resolutions. I can style it to half size, but then the aspect ratio is messed up on certain photos. I was thinking about just converting the photos to a smaller version, but I want to keep the full size for click events. Will this take too much processing time on the clients machine?

Heres another failed attempt at js:
I noticed the screen went blank for a sec on refresh with this script, is that because of "document.getElementsByTagName('IMG')"?

Aaaaaaah. Wow, that is nasty. The "solution" to that would be to create an intermediate "snapshot" that is half size. But that would mean a whole extra version of every one of your pictures that you'd have to resize, store on your server, AND make your visitor download. This way you only need the one version of the image and though it loads really slow, you've taken the hit downloading the image right there. If people decide to click through, they've already got the whole image. Catch 22, but I guess if I were in your position, I might do it this way too. Large images are just a pain to work with.

This probably also falls under the category of stupid questions, (I can't help it, I'm so good at them ).

Here are a couple quick checks. One, try using 0.5 instead of just .5, Two try dividing by 2 instead of multiplying by decimal. Three, javascript can be forgiving about semicolons, but CSS isn't as nice. I think your this.style needs to include a final semicolon...

Code:

this.style = 'height:'+ht+';width:'+wh+';'

I do think your getting closer, but then I'm not a browser so you shouldn't care what I think.

Another things you could do, purely for testing, is you can assign the style to a variable so you can check it before you assign it to this.style. e.g.

That'd let you confirm that the style string is really being written the way you want before it's included, e.g. in case ht and wh aren't being calculated the way you expect.

If that doesn't work, come back with the code from one of your pages, so we can set up our own mockup of what your working with and hopefully see it fail the exact same way you do. Maybe that will kick loose a cobweb or two in the old noggin. Here's hoping some of my brilliant advice fixes things and you don't have to bother.

Whatever you can do or dream you can, begin it.
Boldness has genius, power and magic in it. Begin it now. Chroniclemaster1, Founder of Earth ChronicleA Growing History of our Planet, by our Planet, for our Planet.

well, I was using a php script to load these images in the first place and i found a forum talking about resizing in php. thats when it clicked, I dont need to resize these things at all, just use the height and width attributes of the image and the getimagesize() php function. So what i did was get the image height and width, divide by my resize ratio, and output the new h and w in the image tag. I stopped working on the jscript, but thanks for the tips on the alert for variable output. I find it really hard to debug javascripts.

I'm glad you got it working with PHP. Yeah, debugging is a pain. I brutalize alerts when I'm trying to debug a javascript problem. When you're debugging in a browser they're a really flexible way to display just about any info you want to know about out of your functions.

Whatever you can do or dream you can, begin it.
Boldness has genius, power and magic in it. Begin it now. Chroniclemaster1, Founder of Earth ChronicleA Growing History of our Planet, by our Planet, for our Planet.