добавьте еще один replace, например 
 
var s = '<img alt="" src="child.jpg" style="width: 640px; height:417px;">'
.replace(/style=".+?"/, 'style="width:100%;"')   // заменит style, если есть
.replace(/<img (?!.*style=)/, '<img style="width:100%;" '); // добавит style, если нет
      
alert(s);
      
s = '<img alt="" src="child.jpg">'
.replace(/style=".+?"/, 'style="width:100%;"')   // заменит style, если есть
.replace(/<img (?!.*style=)/, '<img style="width:100%;" '); // добавит style, если нет
      
alert(s);
	 |