慕丝8848655
2016-06-19 19:32
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
div{
width:400px; height:400px;
position: relative; border:solid 1px red;}
.close{ position: absolute; right:0; top:0;}
img{ width:400px; height:400px;}
</style>
<script>
function hide(){
var get=document.getElementById("kk").style.display='none'
}
</script>
</head>
<body>
<div class="kk"><a href="#"><img src="http://a2.qpic.cn/psb?/V13ve7901udi4I/TGaUcEPsZFinuujGs5TJCXIWyhijQpwES5iwiU1frAQ!/b/dG8BAAAAAAAA&bo=RgKmAgAAAAADB8I!&rf=viewer_4"/></a><a href="javascript:hide()" class="close">关闭</a></div>
</body>
</html>
div中kk设定的是class值,js中获取kk是id值,所以找不到元素。
鼠标拖拽效果
25993 学习 · 142 问题
相似问题