Forum Moderators: open

Message Too Old, No Replies

Updating img src

Need to update the src of img after onclick

         

tekomp

4:40 am on Apr 8, 2006 (gmt 0)

10+ Year Member



Hi,

I have a form where I enter an image URL and then when I click a button, the ajax takes that URL, feeds it to my PHP script which then fetches the picture, stores in locally, and then returns the location of local picture.

HTML:
<img class="floatRight" src="" />

CSS:
img.floatRight { float: right; display: none }

My PHP can return the location of the new picture, I just don't know how to get that into: src="picture.jpg".

I've only used innerHTML before, but that replaces everything between two tags. Any ideas?

Thanks.

tekomp

4:54 am on Apr 8, 2006 (gmt 0)

10+ Year Member



Nevermind. Got it working by using document.pic.src = newUrl