开发者

replace image (by clicking on image)

I want to do something like this. After click on image I want to choose another 开发者_如何学编程image for upload replace on server and dynamic display new one.

Thank you for any tip.


Try something like this:

$("img").click(function(){
    $(this).attr("src", "http://example.com/someImage.gif");
});


You can try with this:

<img src="current_image.jpg" onclick="javascript:this.src='new_image.jpg';" />


maybe you try using a upload form and send the upload to a hidden iframe... add a listener to this iframe to check when the file is complete upload... and retrieve the url of the new image and update the src of the img element

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜