开发者

replace image (by clicking on image)

开发者 https://www.devze.com 2023-03-06 23:23 出处:网络
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.

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

精彩评论

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