在dw中如何用js控制css的背景图片不显示
因为某些特殊原因,我想在那一串????的地方插入一段话,让HTTYD/picture/background-1.png在移动设备中不显示,识别移动设备的代码在网上找到了,...
因为某些特殊原因,我想在那一串????的地方插入一段话,让HTTYD/picture/background-1.png在移动设备中不显示,识别移动设备的代码在网上找到了,应该只要在?????的地方写不显示css背景图片的话就可以了
<head>
<meta charset="utf-8">
<title>XXXXX</title>
<style type="text/css">
body {
background-image: url(HTTYD/picture/background-1.png);
background-repeat: no-repeat;
background-position: center top;
background-attachment: fixed;
background-color: #181a1a;
text-align: center;
}
body,td,th {
font-family: "微软雅黑";
color: #FFFFFF;
font-size: 24px;
margin-top: 50px;
background-size: cover;
}
</style>
<script type="text/javascript">
function browserRedirect()
{
var sUserAgent= navigator.userAgent.toLowerCase();
var bIsIpad= sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp= sUserAgent.match(/midp/i) == "midp";
var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid= sUserAgent.match(/android/i) == "android";
var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)
{????????????;}
}
browserRedirect();
</script>
</head> 展开
<head>
<meta charset="utf-8">
<title>XXXXX</title>
<style type="text/css">
body {
background-image: url(HTTYD/picture/background-1.png);
background-repeat: no-repeat;
background-position: center top;
background-attachment: fixed;
background-color: #181a1a;
text-align: center;
}
body,td,th {
font-family: "微软雅黑";
color: #FFFFFF;
font-size: 24px;
margin-top: 50px;
background-size: cover;
}
</style>
<script type="text/javascript">
function browserRedirect()
{
var sUserAgent= navigator.userAgent.toLowerCase();
var bIsIpad= sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp= sUserAgent.match(/midp/i) == "midp";
var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid= sUserAgent.match(/android/i) == "android";
var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile";
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)
{????????????;}
}
browserRedirect();
</script>
</head> 展开
3个回答
推荐于2016-09-11
展开全部
1、给整个网页加背景图片
<style type="text/css">
body {background-image: url(images/123.jpg);}
</style>
2、给表格添加背景图片
<table width="960" border="1" background="images/123.JPG">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
3、给某个盒子或块添加背景
<div class="box" style="background="images/123.JPG"">
正文文字......
</div>
4、给表单或其它标签添加背景方法同上,另外用CSS和div修改背景图片较方便
<style type="text/css">
body {background-image: url(images/123.jpg);}
</style>
2、给表格添加背景图片
<table width="960" border="1" background="images/123.JPG">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
3、给某个盒子或块添加背景
<div class="box" style="background="images/123.JPG"">
正文文字......
</div>
4、给表单或其它标签添加背景方法同上,另外用CSS和div修改背景图片较方便
展开全部
body.style.background-image=‘none’
追问
语法错误
追答
你要先取到这个对象,你可以给这个body设一个ID,比如
var aa=document.getElementById('aa');
aa.style.backgroundImage=none;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
ele.style.background=null;
追问
还是会显示背景
追答
ele.style.background=none;或者ele.style.background="",ele.style.background=transparent;你都试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询