我只需要有人指导我如何从javascript页面获取值并将它们插入表格中的html页面,而不是将一大块值反馈给我,欢呼。
Javascript:
document.write(''
+ 'Browser Name: ' + objbrowserName + '<br>'
+ 'Full Version: ' + objfullVersion + '<br>'
+ 'Major Version: ' + objbrowserName + " " + objBrMajorVersion + '<br>'
+ 'Navigator Name: ' + navigator.appName + '<br>'
+ 'Navigator UserAgent: ' + navigator.userAgent + '<br>'
+ 'Operating System: ' + OSName + '<br>'
+ 'Cookies Enabled: ' + Cookies + '<br>'
+ 'Java Enabled: ' + Java + '<br>'
+ 'Flash Player Version: ' + version + '<br>'
+ 'WebSockets Supported: ' + WebSocket + '<br>'
+ 'Browser Size: ' + BrowserW + " x " + BrowserH + '<br>'
+ 'Screen Size: ' + ScreenW + " x " + ScreenH + '<br>'
+ 'Colour Depth: ' + Depth + '<br>'
)
这是返回的内容:
Browser Name: Chrome
Full Version: 41.0.2272.89
Major Version: Chrome 41
Navigator Name: Netscape
Navigator UserAgent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36
Operating System: Windows
Cookies Enabled: True
Java Enabled: True
Flash Player Version: 17,0,0
WebSockets Supported: True
Browser Size: 500 x 420
Screen Size: 1280 x 1024
Colour Depth: 24 bit
但是我希望能够将数据分解为包含2列的表格,但我对如何从JS文件中获取数据感到困惑。
答案 0 :(得分:3)
这是解决方案
<强>的Javascript 强>
<script>
function get_value(){
var BrowserName = objbrowserName;
document.getElementById('mydiv').innerHTML = BrowserName;
}
</script>
<强> HTML 强>
<div id="mydiv"></div>
<button type="button" onclick="get_value();">Get Value</button>