这个js代码不起作用,大家帮忙看看
$('#sys-role-dg-toolbar').style().backgroundImage = url('static/images/login_img.jpg');
应该这样写:$('#sys-role-dg-toolbar').style.backgroundImage = url('static/images/login_img.jpg');
$('#sys-role-dg-toolbar').css({background:"url('static/images/login_img.jpg')"});
原生js应该这么写 document.getElementById("sys-role-dg-toolbar").style.backgroundImage="url('static/images/login_img.jpg')";
jq:
$('#sys-role-dg-toolbar').css("background-image":"url('static/images/login_img.jpg')");
js:
document.getElementById("sys-role-dg-toolbar").style.backgroundImage="url('static/images/login_img.jpg')";
以及解决了,谢谢各位
已经解决了,谢谢各位
<div id="sys-role-dg-toolbar" align="center" class="wrap-box"
style="height:800px;background-image: url('/static/images/login_img.jpg');
background-repeat: no-repeat; ">