在Javascript中动态设置CSS背景

在Javascript中动态设置CSS背景,javascript,html,css,cordova,stylesheet,Javascript,Html,Css,Cordova,Stylesheet,我有一个Cordova Win8手机应用程序,其中。。我想为stylehseet动态设置背景图像属性 #profile { background-image: url('**____SET__DYNAMICALLY____**'); background-repeat: no-repeat; background-position: top center; position: relative; } 我在下面试过了,但没用 document.getElementBy

我有一个Cordova Win8手机应用程序,其中。。我想为stylehseet动态设置背景图像属性

#profile {
  background-image: url('**____SET__DYNAMICALLY____**');
  background-repeat: no-repeat;
  background-position: top center;
  position: relative;
}
我在下面试过了,但没用

      document.getElementById("#profile")="background-image: url('" + bgimage + "');";
有什么想法吗?谢谢

document.getElementById("profile").style.backgroundImage
    = "url(" + bgimage + ")";