TypeError: document.body is null_js报错解决办法
2017-04-28 13:58
375 查看
今天在使用如下js代码的时候,发现报错:document.body is null
原来document.body必须写在<body>标签之后,不然的话,document.body还未定义。自然就会报错:document.body is null了
<script type="text/javascript"> var dw=document.body.clientWidth; </script>
原来document.body必须写在<body>标签之后,不然的话,document.body还未定义。自然就会报错:document.body is null了
相关文章推荐
- js编写中遇到的问题-TypeError: document.body is null
- JS TypeError: $.browser is undefined 解决办法
- .net 使用模板页,JS使用document.getElementById("")得到null的解决办法
- Chrome调试JS报错“Uncaught ReferenceError: xl_chrome_menu is not defined”的解决办法
- error Type referred to is not an annotation type 一个解决办法
- TypeError: datetime.datetime(2016, 9, 25, 21, 12, 19, 135649) is not JSON serializable解决办法(json无法序列化对象的解决办法)
- js报错:TypeError: document.GetElementById is not a function
- Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node 解决办法
- js关于无法获取clientHeigth / scrollTop 等值解决办法。 介于DocumentElement与body差别
- JS中“null'document.getElementById为空或不是对象” 的解决办法
- Chrome调试JS报错“Uncaught ReferenceError: xl_chrome_menu is not defined”的解决办法
- Sea.js出现Uncaught TypeError: object is not a function的解决方法
- Python 出现错误TypeError: ‘NoneType’ object is not iterable解决办法
- JS中“null'document.getElementById为空或不是对象” 的解决办法
- Chrome调试JS报错“Uncaught ReferenceError: xl_chrome_menu is not defined”的解决办法
- CodeSign error: code signing is required for product type Application in SDK iOS解决办法
- Uncaught TypeError: $.cookie is not a function 解决办法
- ajaxfileupload.js上传文件时jQuery.handleError is not a function的 解决办法
- Android6.0加载Xutils-2.6.14.jar出现retry error, curr request is null 解决办法
- knockout-2.1.0.js绑定数据报Uncaught TypeError: Cannot read property 'nodeType' of null 等异常的解决办法