Dreamweaver在网页一开始只有一排小图,当鼠标移到其中一张小图上,在上面显示大图
2个回答
展开全部
给图片设置两个属性 onmouseover="document1()" onmouseout="document2()" 分别触发两个函数
<img src=" " id="dd" onmouseover="document1()" onmouseout="document2()" />
<script >
function document1(){
v1=document.getElementById("dd");
v1.style.height="400";
v1.style.width="600";
}
function document2(){
v1=document.getElementById("dd");
v1.style.height="200";
v1.style.width="200";
}
</script>
<img src=" " id="dd" onmouseover="document1()" onmouseout="document2()" />
<script >
function document1(){
v1=document.getElementById("dd");
v1.style.height="400";
v1.style.width="600";
}
function document2(){
v1=document.getElementById("dd");
v1.style.height="200";
v1.style.width="200";
}
</script>
展开全部
如果要做这个效果,就要用到javascript!!只用HTML+CSS不能实现这个效果哟!
我简单的写一个效果,在IE8和火狐浏览器下能正常运行:
<!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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
div{
}
#div1 {
cursor: auto;
background-color: #003;
height: 100px;
width: 100px;
float:left;
margin-left:100px;
margin-top:100px;
}
#div2 {
background-color: #069;
height: 100px;
width: 100px;
float:left;
margin-left:100px;
margin-top:100px;
}
.theClass {
display:none;
position:absolute;
background-color: #300;
height: 200px;
width: 200px;
}
</style>
</head>
<body>
<div id="div1" ></div>
<div id="div2" ></div>
<div id="div3" class="theClass"></div>
<div id="div4" class="theClass"></div>
<script>
var adiv1=document.getElementById('div1');
var adiv2=document.getElementById('div2');
var adiv3=document.getElementById('div3');
var adiv4=document.getElementById('div4');
adiv3.style.marginTop=50+'px';adiv3.style.marginLeft=50+'px';
adiv4.style.marginTop=50+'px';adiv4.style.marginLeft=250+'px';
adiv3.onmouseover=adiv1.onmouseover=function()
{
adiv3.style.display='block';
}
adiv4.onmouseover=adiv2.onmouseover=function()
{
adiv4.style.display='block';
}
adiv3.onmouseout=adiv1.onmouseout=function()
{
adiv3.style.display='none';
}
adiv4.onmouseout=adiv2.onmouseout=function()
{
adiv4.style.display='none';
}
</script>
</body>
</html>
你只要在相应的位置加上图片地址能好了!
不知道这么说回答了你的问题没有?
我简单的写一个效果,在IE8和火狐浏览器下能正常运行:
<!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=utf-8" />
<title>无标题文档</title>
<style type="text/css">
div{
}
#div1 {
cursor: auto;
background-color: #003;
height: 100px;
width: 100px;
float:left;
margin-left:100px;
margin-top:100px;
}
#div2 {
background-color: #069;
height: 100px;
width: 100px;
float:left;
margin-left:100px;
margin-top:100px;
}
.theClass {
display:none;
position:absolute;
background-color: #300;
height: 200px;
width: 200px;
}
</style>
</head>
<body>
<div id="div1" ></div>
<div id="div2" ></div>
<div id="div3" class="theClass"></div>
<div id="div4" class="theClass"></div>
<script>
var adiv1=document.getElementById('div1');
var adiv2=document.getElementById('div2');
var adiv3=document.getElementById('div3');
var adiv4=document.getElementById('div4');
adiv3.style.marginTop=50+'px';adiv3.style.marginLeft=50+'px';
adiv4.style.marginTop=50+'px';adiv4.style.marginLeft=250+'px';
adiv3.onmouseover=adiv1.onmouseover=function()
{
adiv3.style.display='block';
}
adiv4.onmouseover=adiv2.onmouseover=function()
{
adiv4.style.display='block';
}
adiv3.onmouseout=adiv1.onmouseout=function()
{
adiv3.style.display='none';
}
adiv4.onmouseout=adiv2.onmouseout=function()
{
adiv4.style.display='none';
}
</script>
</body>
</html>
你只要在相应的位置加上图片地址能好了!
不知道这么说回答了你的问题没有?
追问
这样的效果可以做到吗?是点一张小图,顺序显示大图,或者是点数字 1,2,3那样分别显示大图,不是在原来的图片上覆盖另一张图
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询