</head>
<body>
<form>
中华民国成立于那一年?
<input type="text" daan="1912年" id="t1" />
<input type="button" onclick="check()" value="检查答案" /></form>
<script>
function check()
{
var a=document.getElementById("t1").value;
var a1=document.getElementById("t1").getAttribute("daan");
if(a==a1)
{
alert("恭喜你答对了")
}
else
{
alert("笨蛋");
}
}
p
</script>
倒计时10秒按钮
<input type="submit" id="b" value="同意(10)" disabled="disabled" />
<script>
var n=10;
var b1=document.getElementById("b");
function bain()
{
n--;
if(n==0)
{
b1.removeAttribute("disabled");
b1.value="同意";
}
else
{
b1.value="同意("+n+")";
window.setTimeout("bain()",1000);
}
}
window.setTimeout("bain()",1000);
</script>
图片转换
</div>
<div id="tuijian" style=" background-image:url(imges/tj1.jpg);">
<div class="pages" id="p1" onclick="dodo(-1)"></div>
<div class="pages" id="p2" onclick="dodo(1)"></div>
</div>
<style type="text/css">
*{ margin:0px auto;
padding:opx;
}
#tuijian
{ 760px;
height:350px;
background-repeat:no-repeat;
}
.pages
{ top:200px;
background:#000;
background-position:center;
background-repeat:no-repeat;
opacity:0.4;
30px;
height:60px;
}
#p1
{ background-image:url(19425902_1364786376573.jpg);
float:left;
margin:150px 0px 0px 10px;
}
#p2
{ background-image:url(161541xr0zaggllyg1rhy0.jpg);
float:left;
margin:150px 0px 0px 0px;
}
</style>
<script language="javascript">
var jpg=new Array();
jpg[0]=url(01.jpg);
jpg[1]=url(02.jpg);
jpg[2]=url(03.jpg);
var tjimg=document.getElementById("tuijian");
var xb=0;
n=0;
function huan()
{ xb++;
if(xb == jpg.length)
{
xb=0;
}
tjimg.style.backgroundImage=jpg[xb];
if(n==0)
{ var id = window.setTimeout("huan()",3000);
}
}
function dodo(m)
{
n=1;
xb = xb+m;
if(xb < 0)
{
xb = jpg.length-1;
}
else if(xb >= jpg.length)
{
xb = 0;
}
tjimg.style.backgroundImage=jpg[xb];
}
window.setTimeout("huan()",3000);
</script>
</body>
</html>