获取电脑时间+前进+后退

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
function qianjin(){
window.history.forward();
}
function wangzhixinxi(){
debugger;
var div1 = document.getElementById("div1");
//
var str = "1-"+window.location.hostname+",2-"+window.location.href+",3-"
+window.location.host+",4-"+location.port+",5-"+location.pathname+",6-"+location.protocol+",7-宽"
+screen.availWidth+",8-高"+screen.availHeight+",浏览器代码:"+navigator.appCodeName
+",名字:"+navigator.appName+",版本:"+navigator.appVersion;

div1.innerText = str;
//确认框

if(confirm("确定跳转吗?")){
alert("您点击了 确认按钮,表示跳转!");
window.location = "http://www.baidu.com";
}


}
function yonghu(){
var name = prompt("请输入用户名","张三");
document.getElementById("div1").innerText = "您输入的名字是:" + name;
}
function shijian(){
var mydate = new Date();
var str = mydate.getFullYear()
       +" "+(mydate.getMonth()+1)
       +" "+mydate.getDate()
       +" "+mydate.getHours()
       +":"+mydate.getMinutes()
       +":"+mydate.getSeconds();
document.getElementById("div1").innerText = str;


}
//定时2秒以后执行mydate()函数。显示系统时间
// setTimeout("mydate()",2000);


//循环执行mydata函数,每隔1秒钟
setInterval(mydate,1000);


</script>
</head>
<body>
<a href="index.html">表单</a><br />
<input type="button" onclick="qianjin()" value="前进" /><br />
<input type=" button" value="显示本网址信息" onclick="wangzhixinxi()"/><br />
<input type="button" value="请输入用户" onclick="yonghu()" /><br />
<input type="button" value="获得当前电脑时间" onclick="shijian()" /><br />
<div id="div1"></div>
</body>

</html>






阅读更多
上一篇帧动画div与文字的使用方法
下一篇添加和删除+全选
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭