用JavaScript进行图片的切换怎么做?
我这里写了代码的,但就是不行!所以麻烦各位帮我改哈!<html><head><metahttp-equiv="Content-Type"content="text/htm...
我这里写了代码的 ,但就是不行!所以麻烦各位帮我改哈!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" language="javascript">
function $(id){
return document.getElementById(id);
}
function init(){
$("job2").style.display = "none";
$("jianli1").style.display = "none";
$("resumtab").style.display = "none";
}
function TabChange(show,hidden){
$(show+"1").style.display="none";
$(show+"2").style.display="block";
$(hidden+"2").style.display="none";
$(hidden+"1").style.display="block";
$(hidden+"tab").style.display="block";
$(show+"tab").style.display="none";
}
</script>
</head>
<body onLoad="javascript:init();">
<img src="../images/logo.jpg">
<table align="center">
<tr>
<td>
<img src="../images/job1.jpg" id="job1" onMouseOver="javascript:TabChange('job','jianli');">
<img src="../images/job2.jpg" id="job2"></td>
<td rowspan="2">
<img src="../images/jobtab.jpg" id="jobtab">
<img src="../images/resumtab.jpg" id="resumtab">
</td>
</tr>
<tr>
<td>
<img src="../images/resum1.jpg" id="jianli1" onMouseOver="javascript:TabChange('jianli','job');">
<img src="../images/resum2.jpg" id="jianli2"></td>
</tr>
</table>
</body>
</html>
如果大家有需要,分数不是问题哈!
请大家帮帮忙哈 展开
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" language="javascript">
function $(id){
return document.getElementById(id);
}
function init(){
$("job2").style.display = "none";
$("jianli1").style.display = "none";
$("resumtab").style.display = "none";
}
function TabChange(show,hidden){
$(show+"1").style.display="none";
$(show+"2").style.display="block";
$(hidden+"2").style.display="none";
$(hidden+"1").style.display="block";
$(hidden+"tab").style.display="block";
$(show+"tab").style.display="none";
}
</script>
</head>
<body onLoad="javascript:init();">
<img src="../images/logo.jpg">
<table align="center">
<tr>
<td>
<img src="../images/job1.jpg" id="job1" onMouseOver="javascript:TabChange('job','jianli');">
<img src="../images/job2.jpg" id="job2"></td>
<td rowspan="2">
<img src="../images/jobtab.jpg" id="jobtab">
<img src="../images/resumtab.jpg" id="resumtab">
</td>
</tr>
<tr>
<td>
<img src="../images/resum1.jpg" id="jianli1" onMouseOver="javascript:TabChange('jianli','job');">
<img src="../images/resum2.jpg" id="jianli2"></td>
</tr>
</table>
</body>
</html>
如果大家有需要,分数不是问题哈!
请大家帮帮忙哈 展开
7个回答
展开全部
<!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>
</head>
<script language="javascript">
var state=0;
var img=new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg","8.jpg");
var lastSRC="";
function top()
{
var OldImage=document.getElementById("Image");
var name=parseInt(OldImage.getAttribute("name"))-1;
if(name<1)
{
alert("已经是第一张!")
name=1;
}else{
lastSRC+="相册/"+img[name-1];
}
OldImage.setAttribute("name",""+name);
OldImage.setAttribute("src",lastSRC);
lastSRC="";
}
function next()
{
OldImage=document.getElementById("Image");
name=parseInt(OldImage.getAttribute("name"))+1;
if(name>8)
{
alert("已经是最后一张")
name=8;
}else{
lastSRC+="相册/"+img[name-1];
}
OldImage.setAttribute("name",""+name);
OldImage.setAttribute("src",lastSRC);
lastSRC="";
}
</script>
<style>
body {
background-color: lightgrey;
}</style>
<body>
<br /><br /><br /><br />
<table align="center" width="500">
<tr><td align="center" colspan="2"><font size="+4">电子相册</font></td></tr>
<tr><td align="center" colspan="2" bgcolor="#666666" bordercolor="#00CCCC" height="400"><img id="Image" name="1" src="相册/1.jpg"/></td></tr>
<tr><td align="left" onclick="top()" style=" cursor:pointer">上一张</td> <td align="right" onclick="next()" style=" cursor:pointer">下一张</td></tr>
</table>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
var state=0;
var img=new Array("1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg","8.jpg");
var lastSRC="";
function top()
{
var OldImage=document.getElementById("Image");
var name=parseInt(OldImage.getAttribute("name"))-1;
if(name<1)
{
alert("已经是第一张!")
name=1;
}else{
lastSRC+="相册/"+img[name-1];
}
OldImage.setAttribute("name",""+name);
OldImage.setAttribute("src",lastSRC);
lastSRC="";
}
function next()
{
OldImage=document.getElementById("Image");
name=parseInt(OldImage.getAttribute("name"))+1;
if(name>8)
{
alert("已经是最后一张")
name=8;
}else{
lastSRC+="相册/"+img[name-1];
}
OldImage.setAttribute("name",""+name);
OldImage.setAttribute("src",lastSRC);
lastSRC="";
}
</script>
<style>
body {
background-color: lightgrey;
}</style>
<body>
<br /><br /><br /><br />
<table align="center" width="500">
<tr><td align="center" colspan="2"><font size="+4">电子相册</font></td></tr>
<tr><td align="center" colspan="2" bgcolor="#666666" bordercolor="#00CCCC" height="400"><img id="Image" name="1" src="相册/1.jpg"/></td></tr>
<tr><td align="left" onclick="top()" style=" cursor:pointer">上一张</td> <td align="right" onclick="next()" style=" cursor:pointer">下一张</td></tr>
</table>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询