【nodejs】关于 alert 和 document
2015-06-30 17:54
549 查看
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Windows\system32>node
> alert
ReferenceError: alert is not defined
at repl:1:1
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)
> document
ReferenceError: document is not defined
at repl:1:1
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)
>
> var i = 0; while (i <= 5)
... {
... console.log("数字是 " + i)
... console.log("<br />")
... i++
... }
数字是 0
<br />
数字是 1
<br />
数字是 2
<br />
数字是 3
<br />
数字是 4
<br />
数字是 5
<br />
5
可以看得出v8引擎 alert和document是没有定义的,这不难理解,没有view就没有必要操作document了,不知道控制台(C# java)程序能否弹出一个对话框。
将前端代码移植到nodejs 需要重构代码,不能有dom操作。
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Windows\system32>node
> alert
ReferenceError: alert is not defined
at repl:1:1
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)
> document
ReferenceError: document is not defined
at repl:1:1
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)
>
> var i = 0; while (i <= 5)
... {
... console.log("数字是 " + i)
... console.log("<br />")
... i++
... }
数字是 0
<br />
数字是 1
<br />
数字是 2
<br />
数字是 3
<br />
数字是 4
<br />
数字是 5
<br />
5
可以看得出v8引擎 alert和document是没有定义的,这不难理解,没有view就没有必要操作document了,不知道控制台(C# java)程序能否弹出一个对话框。
将前端代码移植到nodejs 需要重构代码,不能有dom操作。
相关文章推荐
- Cannot install NodeJs: /usr/bin/env: node: No such file or directory
- node.js的开发学习
- Node.js学习开始了——事件流的控制/文件读写事件的的方法
- NodeJs学习笔记一(ubuntu下环境搭建)
- Leetcode42: Remove Nth Node From End of List
- nodejs导出excel的方法
- How to install 3 nodes Nutanix Cluster in one ESXi 6.0 Server
- 动态修改 NodeJS 程序中的变量值
- ENode框架Conference案例转载
- ENode框架Conference案例分析系列之 - 订单处理减库存的设计
- nodejs导出excel的方法
- LeetCode_Linked List_Swap Nodes in Pairs
- LeetCode-Count Complete Tree Nodes -解题报告
- nodejs socket error Error:read ECONNRESET
- nodejs 导出excel
- 解决 SVN Skipped 'xxx' -- Node remains in conflict
- Socket.IO 和 Node.js 入门
- 完全面向于初学者的Node.js指南
- 阿里云性能真的是差到了极点……
- node.js读取文件到字符串的方法