为了账号安全,请及时绑定邮箱和手机立即绑定

就这样子啦

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>

<body>

<script type="text/javascript">

var w=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;

var h=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;

document.write(w+"<br/>"+h);

</script>

</body>

</html>


正在回答

1 回答

var w= document.documentElement.clientWidth
      || document.body.clientWidth;
var h= document.documentElement.clientHeight
      || document.body.clientHeight;

注意格式

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
JavaScript进阶篇
  • 参与学习       467145    人
  • 解答问题       21875    个

本课程从如何插入JS代码开始,带您进入网页动态交互世界

进入课程

就这样子啦

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信