<!doctype html>
<html>
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function (){
$("p").text(function(){
var color='';
var p=document.getElementsByTagName('p');
for(var i = 0; i < p.length; i++){
color+=$(p[i]).css("background-color")+'\n';
}
alert(color);
});
});
});
</script>
</head>
<body>
<p style = "background-color:red">this is red</p>
<p style = "background-color:green">this is green</p>
<p style = "background-color:blue">this is blue</p>
<button> return </button>
</body>
</html>
Вот как сделал.