Forum Moderators: open

Message Too Old, No Replies

JavaScript and &

Trying to write URL to DOM using & in URL

         

brodyh

8:32 am on May 15, 2009 (gmt 0)

10+ Year Member



I have a JavaScript that writes some images to a page, but the URLs to the images actually point to a PHP script where the images are resized (so the URL would be something like imageresize.php?width=70&image=image.png).

Because I prefer to use proper XHTML, I have the JavaScript output the URL like this: imageresize.php?width=70&image=image.png. However this causes the images not to show up, and I'm unsure why. Using the incorrect code (that is, just using a & instead of the entity &amp) causes an error (which, it should).

I have tried using encodeURI() with no luck.

Any suggestions?

brodyh

8:44 am on May 15, 2009 (gmt 0)

10+ Year Member



Sorry everybody.. just realized the problem was not JavaScript-related. I was referencing the image incorrectly.