我提供一点例子数据
var text = "<p style="background-color:#ffffff;text-indent:0px;color:#333333;">
<img style="width:666px;height:402px;" alt="" src="/admin/kindeditor/attached/image/20140504/20140504080935_30878.jpg" width="673" height="402" /></p><p style="background-color:#ffffff;text-indent:0px;color:#333333;">
<img style="width:666px;height:402px;" alt="" src="/admin/kindeditor/attached/i04/20140504080935_30878.jpg" width="673" height="402" /></p>
";
需要操作的就是获取这段数据中的img的src 然后在src前面添加http://www.nmgjzw.com
说白了就是更改src
如果这样的话就会替换整个页面的图片了,有没有方法只更改这个内容的img
追答var text=text.replace("src=\"","src=\"http://www.nmgjzw.com")
本回答被提问者采纳