2011-01-07 21 views
0

私はこのスクリプトを持っていますが、result.bgimageは表示されません。JSは変数ではなく文字列だと思います!どうすればこの問題を解決できますか? `ことになっresult.bgimage`は何おかげJavaScript文字列の問題?

$('#bg') 
    .animate({opacity: 0}, 'slow', function() { 
     $(this) 
      .css({'background-image': 'url(result.bgimage)'}) 
      .animate({opacity: 1}); 
    }); 
+1

?変数の場合は、文字列の外側に置くだけです –

答えて

3
$('#bg') 
    .animate({opacity: 0}, 'slow', function() { 
     $(this) 
      .css({'background-image': 'url(' + result.bgimage + ')'}) 
      .animate({opacity: 1}); 
    });