61,112
社区成员
发帖
与我相关
我的任务
分享
.test:hover img {
border: 1px solid green;
}
<a href="#" class="test">
<img id="t" src="Edit/query.gif"
border="0" width="120" height="29"/>
</a>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
.a1 {
margin: 0 4px;
background: #00F5FF;
height: 1px;
overflow: hidden;
}
.a2 {
margin: 0 2px;
border: 2px solid #00F5FF;
border-width: 0 2px;
background: #E1E7E9;
height: 1px;
overflow: hidden;
}
.a3 {
margin: 0 1px;
border: 2px solid #00F5FF;
border-width: 0 1px;
background: #E1E7E9;
height: 1px;
overflow: hidden;
}
.a4 {
margin: 0 1px;
border: 2px solid #00F5FF;
border-width: 0 1px;
background: #E1E7E9;
height: 1px;
overflow: hidden;
}
.m1 {
background: #E1E7E9;
border: 2px solid #00F5FF;
border-width: 0 1px;
}
.m2 {
background: #FFF;
margin: 0 0.5px;
font-size: 0.5px;
font-family: Verdana;
color: #333;
padding: 0.5px 0.5px;
overflow: hidden;
}
.b1 {
margin: 0 1px;
border: 2px solid #00F5FF;
border-width: 0 1px;
background: #E1E7E9;
height: 1px;
overflow: hidden;
}
.b2 {
margin: 0 1px;
border: 2px solid #00F5FF;
border-width: 0 2px;
background: #E1E7E9;
height: 1px;
overflow: hidden;
}
.b3 {
margin: 0 2px;
border: 2px solid #00F5FF;
border-width: 0 2px;
background: #E1E7E9;
height: 1px;
overflow: hidden;
}
.b4 {
margin: 0 4px;
background: #00F5FF;
height: 1px;
overflow: hidden;
}
</style>
<script type="text/javascript">
function atQuery(){
alert(1);
}
function addCss(){
document.getElementById('a1').setAttribute( "className", "a1");
document.getElementById('a2').setAttribute( "className", "a2");
document.getElementById('a3').setAttribute( "className", "a3");
document.getElementById('a4').setAttribute( "className", "a4");
document.getElementById('m1').setAttribute( "className", "m1");
document.getElementById('m2').setAttribute( "className", "m2");
document.getElementById('b1').setAttribute( "className", "b1");
document.getElementById('b2').setAttribute( "className", "b2");
document.getElementById('b3').setAttribute( "className", "b3");
document.getElementById('b4').setAttribute( "className", "b4");
}
function deleteCss(){
document.getElementById('a1').setAttribute( "className", "");
document.getElementById('a2').setAttribute( "className", "");
document.getElementById('a3').setAttribute( "className", "");
document.getElementById('a4').setAttribute( "className", "");
document.getElementById('m1').setAttribute( "className", "");
document.getElementById('m2').setAttribute( "className", "");
document.getElementById('b1').setAttribute( "className", "");
document.getElementById('b2').setAttribute( "className", "");
document.getElementById('b3').setAttribute( "className", "");
document.getElementById('b4').setAttribute( "className", "");
}
</script>
</head>
<body>
<table>
<tr>
<td >
<div id="a1"></div>
<div id="a2"></div>
<div id="a3"></div>
<div id="a4"></div>
<div id="m1">
<div id="m2">
<a> <img id="tableQuery" src="Edit/tableQuery.gif"
onmouseover="addCss()" onmouseout="deleteCss()" border="0"
onclick="atQuery()" /> </a>
</div>
</div>
<div id="b1"></div>
<div id="b2"></div>
<div id="b3"></div>
<div id="b4"></div>
</td>
</tr>
</table>
</body>
</html>
这个总算有点效果了,,但是我想把页面上的<a>标签上下的那些<div>也在js里加入。为什么从js加入时边框左右不会出现呢。。百思不得其解。
在设置圆角的div里面
加上
overflow:hidden;
<style type="text/css">
body { text-align: center; font: 12px Arial normal; }
.frame-block { margin: 0 auto; position: relative; height:500px; width: 335px; }
.frame-block span { background: url(/uploadfile/frame.png) no-repeat center top; height:500px; width: 335px; display: block; position: absolute; }
span { behavior: url(/uploadfile/iepngfix.htc) }
<div class="frame-block"> <span></span> <img src="/uploadfile/sample.jpg" /> </div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
img#img1 {
float:left;
width:300px;
height:300px;
display:block;
}
img#img2 {
float:left;
margin-left:-300px;
width:300px;
height:300px;
display:block;
}
</style>
</head>
<body>
<img id="img1" src="1.jpg"/><img id="img2" src="a.gif"/>
</body>
</html>