<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title></title></head><body><p>123456</p><img src="../img/1.PNG" alt=""/><input type="button" id="a" value="点击刷新"></input><script>/*screen对象*/
var height=screen.height;
var width=screen.width;
var availHeight=screen.availHeight;
var availWidth=screen.availWidth;
alert('屏幕的高度是'+height)
alert('屏幕的宽度是'+width)
alert('屏幕的可用高度是'+availHeight)
alert('屏幕的可用宽度是'+availWidth)
/*location对象*/
/*获取当前页面的url*/
var href=location.href;
var host=location.host;
alert(href)
alert(host)
/*改变当前页面的url*/
location.href='https://www.baidu.com';
/*改变当前页面的url的简单写法*/
location='https://www.baidu.com';
window.onload=function() {
/*手动刷新*/
var a = document.getElementById('a');
/*添加点击事件*/
a.onclick = function () {
location.reload();
/*//修改当前文档 ,作用类似 location.href
location.replace('https://www.baidu.com');
location.assign('https://www.baidu.com');*/
alert('ss')
}
}
</script></body></html>