Javascript写的下拉框不显示图像为什么呢
<!doctypehtml><html><head><metacharset="utf-8"><title>无标题文档</title><style>body,div,im...
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
body, div, img, span {
margin: 0;
padding: 0;
}
#content {
width: 960px;
height: 1000px;
background: #ccc;
margin: 0 auto;
}
#ad {
width: 960px;
margin: 0 auto;
display: none;
position: relative;
overflow: hidden;
}
#close {
position: absolute;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
background: #CF3;
top: 0;
right: 0;
display: none;
cursor: pointer;
}
</style>
</head>
<body>
<div id="ad">
<img id="adcon" src="顶部广告(源代码)/ad.png" width="960" height="386"/>
<img id="adcur" src="顶部广告(源代码)/cur.png" width="960" height="68"/>
<span id="close">X</span>
</div>
<div id="content"><img src="顶部广告(源代码)/数字商品-10-23.jpg" /></div>
<script>
<!--var oadcon=document.getElementById("adcon");
<!--var oadcur=document.getElementById("adcur"); -->
<!--var oclose=document.getElementById("close"); --> -->
var getId=function(id){
return document.getElementById(id);
}
var h=0;
var step=5;
var maxh=getId('adcon').height;
var minh=getId('adcur').height;
<!--图片向下展开-->
function picdom(){
if(h<maxh){
h+=step;
setTimeout(picdom,1);
}
else{
setTimeout(picup,3000);
}
getId('ad').style.display="block";
getId('ad').style.height=h+"px";
}
<!--图片向上收起-->
function picup(){
if(h>minh){
h=h-step;
setTimeout(picup,1);
}
close.style.display='block';
}
</script>
</body>
</html> 展开
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
body, div, img, span {
margin: 0;
padding: 0;
}
#content {
width: 960px;
height: 1000px;
background: #ccc;
margin: 0 auto;
}
#ad {
width: 960px;
margin: 0 auto;
display: none;
position: relative;
overflow: hidden;
}
#close {
position: absolute;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
background: #CF3;
top: 0;
right: 0;
display: none;
cursor: pointer;
}
</style>
</head>
<body>
<div id="ad">
<img id="adcon" src="顶部广告(源代码)/ad.png" width="960" height="386"/>
<img id="adcur" src="顶部广告(源代码)/cur.png" width="960" height="68"/>
<span id="close">X</span>
</div>
<div id="content"><img src="顶部广告(源代码)/数字商品-10-23.jpg" /></div>
<script>
<!--var oadcon=document.getElementById("adcon");
<!--var oadcur=document.getElementById("adcur"); -->
<!--var oclose=document.getElementById("close"); --> -->
var getId=function(id){
return document.getElementById(id);
}
var h=0;
var step=5;
var maxh=getId('adcon').height;
var minh=getId('adcur').height;
<!--图片向下展开-->
function picdom(){
if(h<maxh){
h+=step;
setTimeout(picdom,1);
}
else{
setTimeout(picup,3000);
}
getId('ad').style.display="block";
getId('ad').style.height=h+"px";
}
<!--图片向上收起-->
function picup(){
if(h>minh){
h=h-step;
setTimeout(picup,1);
}
close.style.display='block';
}
</script>
</body>
</html> 展开
1个回答
展开全部
<select onchange="changePic(this.value)">
<option value="1">1111111111</option>
<option value="2">222222222222</option>
</select>
<img id=showme src="3.jpg" />
<script>
function changePic(path){
document.getElementById("showme").src=path+".jpg";
}
</script>
<option value="1">1111111111</option>
<option value="2">222222222222</option>
</select>
<img id=showme src="3.jpg" />
<script>
function changePic(path){
document.getElementById("showme").src=path+".jpg";
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询