1.runjs Դ?java 反射源码?
2.js里怎么将 document.getElementById 改成调用 class 类的名称
runjs Դ??
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>RunJS</title>
<script>
var nn;
onload=function(){
setInterval(function(){
var n=new Date;
if(nn==null)
dd.innerHTML=n.getHours()+":"+n.getMinutes()+":"+n.getSeconds();
else
dd.innerHTML=nn+":"+n.getMinutes()+":"+n.getSeconds();
});
}
var add=function(){
var n=new Date;
if(null==nn)
nn=n.getHours()+1;
else
nn++;
}
var sub=function(){
var n=new Date;
if(null==nn)
nn=n.getHours()-1;
else
nn--;
}
var orial=function(){
var n=new Date;
nn=n.getHours();
}
</script>
</head>
<body>
<div id="dd">
</div>
<input type="button" value="+1" onclick="add()" />
<input type="button" value="-1" onclick="sub()"/>
<input type="button" value="恢复" onclick="orial()"/>
</body>
</html>
js里怎么将 document.getElementById 改成调用 class 类的名称
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
RunJS 演示代码
</title>
<script type="text/javascript">
function test(obj) {
if (obj.id == "Radio1") {
document.querySelector(".Div1").style.display = "block";
document.querySelector(".Div2").style.display = "none";
}
if (obj.id == "Radio2") {
document.querySelector(".Div1").style.display = "none";
document.querySelector(".Div2").style.display = "block";
}
}
</script>
</head>
<body>
<input type="button" id="Radio1" onclick="test(this)" value="我" />
<input id="Radio2" type="button" onclick="test(this)" value="你" />
<div class="Div1" style="display:none;">
aaaa
</div>
<div class="Div2" style="display:none;">
bbbb
</div>
</body>
</html>