标签:body art you type 放弃 class red 事件监听 错误
<script type="text/javascript"> var check = xViewer.check(); if (check.noErrors) { ... } </script>
只需运行这个静态函数,它就会报告您的任何错误或警告(当然,一般情况下不会遇到错误与警告提示)。
完整的程序如下:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Hello building!</title> <link href="css/layout.css" rel="stylesheet" /> <script src="js/xbim-viewer.debug.bundle.js"></script> </head> <body> <div id="content"> <canvas id="viewer" width="500" height="300"></canvas> <script type="text/javascript"> var check = xViewer.check(); if (check.noErrors) { var viewer = new xViewer(‘viewer‘); viewer.load(‘data/SampleHouse.wexbim‘); viewer.start(); } </script> </div> </body> </html>
检查结果中包含警告列表和错误列表,可以用来向用户报告为什么他的旧的,非标准的浏览器不支持WebGL功能。
<script type="text/javascript"> var check = xViewer.check(); if (check.noErrors) { //在此处做事件监听,业务处理等 } else { var msg = document.getElementById(‘msg‘); msg.innerHTML = ‘‘; for(var i in check.errors) { var error = check.errors[i]; msg.innerHTML += "<div style=‘color: red;‘>" + error + "</div>"; } } </script>
参考:http://docs.xbim.net/XbimWebUI/tutorial-2_Safe_Hello_building.html
2019-06-04
标签:body art you type 放弃 class red 事件监听 错误
原文地址:https://www.cnblogs.com/SavionZhang/p/10972613.html