set background linear-gradient through javascript code example
Example: change linear bagckgorund by javascript
function getCssValuePrefix()
{
var rtrnVal = '';
var prefixes = ['-o-', '-ms-', '-moz-', '-webkit-'];
var dom = document.createElement('div');
for (var i = 0; i < prefixes.length; i++)
{
dom.style.background = prefixes[i] + 'linear-gradient(#000000, #ffffff)';
if (dom.style.background)
{
rtrnVal = prefixes[i];
}
}
dom = null;
delete dom;
return rtrnVal;
}
dom.style.backgroundImage = getCssValuePrefix() + 'linear-gradient('
+ orientation + ', ' + colorOne + ', ' + colorTwo + ')';