js新手菜鸟求助各位大神指点,实现不了div背景切换啊,代码: 本帖最后由 angryBirds2014 于 2014-08-01 18:18:59 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!doctype html><html lang="en-US"><head> <meta charset="UTF-8"> <title></title> <style type="text/css"> .content_bg { width:100%; height:100%; color:red; background: #ccc; /*background-image:url("../images/2.gif");*/ } </style></head><body><div id="content_bg" class="content_bg"> <div class="content_font" style="text-align: center;"> <ul style="list-style: none; float: left; width: 200px; height: 204px"> <span>3C</span> <li>hello</li> <li>hello</li> <li>hello</li> <li>hello</li> <li>hello</li> </ul> <ul style="list-style: none; float: left; width: 200px; height: 204px"> <span>3C</span> <li>hello</li> <li>hello</li> <li>hello</li> <li>hello</li> <li>hello</li> </ul> <ul style="list-style: none; float: left; width: 200px; height: 204px"> <span>3C</span> <li>hello</li> <li>hello</li> <li>hello</li> <li>hello</li> <li>hello</li> </ul> </div></div><script type="text/javascript"> function getStyle(obj, name){ if(obj.currentStyle){ return obj.currentStyle[name]; } else { return getComputedStyle(obj, false)[name]; } } window.onload = pageOnload; function pageOnload() { var bg = document.getElementById("content_bg"); var d = getStyle(bg, 'backgroundColor'); alert(d); } function changeBg(num) { //bg.background = num + ".gif"; //bg.style.backgroundImage = "../images/"+num+".gif"; // alert(bg.style.backgroundImage); //alert("../images/"+num+".gif"); alert(bg.style.backgroundImage); }</script></body></html> TitlePane中嵌套TitlePane导致数据无法显示.docx css浮动 层数据设置修改问题 删除一段字符串 高分就解 怎么才能使window.location失效,烦,去广告页面重定向 怎样用javascript修改datagrid里面的数据? 增加在点击事件中 为什么程序名字都是MM_*****() 请问js中,如何知道一个值是否为数字? js计算年龄并比较大小 100分请高手来改个jQuery代码,代码很简单,是关于显示和隐藏 外部函数调用不成功
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.content_bg
{
width:100%;
height:100%;
color:red;
background: #ccc;
/*background-image:url("../images/2.gif");*/ }
</style>
</head>
<body>
<div id="content_bg" class="content_bg">
<div class="content_font" style="text-align: center;">
<ul style="list-style: none; float: left; width: 200px; height: 204px">
<span>3C</span>
<li>hello</li>
<li>hello</li>
<li>hello</li>
<li>hello</li>
<li>hello</li>
</ul>
<ul style="list-style: none; float: left; width: 200px; height: 204px">
<span>3C</span>
<li>hello</li>
<li>hello</li>
<li>hello</li>
<li>hello</li>
<li>hello</li>
</ul>
<ul style="list-style: none; float: left; width: 200px; height: 204px">
<span>3C</span>
<li>hello</li>
<li>hello</li>
<li>hello</li>
<li>hello</li>
<li>hello</li>
</ul>
</div>
</div>
<script type="text/javascript">
function getStyle(obj, name){
if(obj.currentStyle){
return obj.currentStyle[name];
} else {
return getComputedStyle(obj, false)[name];
}
} window.onload = pageOnload;
function pageOnload() {
var bg = document.getElementById("content_bg");
var d = getStyle(bg, 'backgroundColor');
alert(d);
} function changeBg(num) {
//bg.background = num + ".gif";
//bg.style.backgroundImage = "../images/"+num+".gif";
// alert(bg.style.backgroundImage);
//alert("../images/"+num+".gif");
alert(bg.style.backgroundImage);
}
</script>
</body>
</html>