【nodejs】关于 alert 和 document
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操作。
【nodejs】关于 alert 和 document的更多相关文章
- jquery bind event, use on. $(document).on("click","#a",function(){alert(1)}) [#document]
$(document).on("click","#a",function(){alert(1)}) [#document] as a replacement o ...
- Console.log,Window.alert,Document.write三者区别
1.Console.log不会阻断程序继续进行,在控制台可以看到测试结果. 2.Window.alert弹出框会阻断程序运行,在弹出框可以看到测试结果. 3.Document.write不会阻断程序继 ...
- 对于javaScript中的alert和document.write()的执行顺序的记录
代码: <script>//1----语句式的匿名函数创建以及调用 (function(name,age){ alert("name:"+name+",age ...
- Vue 2.x + Webpack 3.x + Nodejs 多页面项目框架(下篇——多页面VueSSR+热更新Server)
Vue 2.x + Webpack 3.x + Nodejs 多页面项目框架(下篇--多页面VueSSR+热更新Server) @(HTML/JS) 这是Vue多页面框架系列文章的第二篇,上一篇(纯前 ...
- 谈谈document.ready和window.onload的区别
在Jquery里面,我们可以看到两种写法:$(function(){}) 和$(document).ready(function(){}) 这两个方法的效果都是一样的,都是在dom文档树加载完之后执行 ...
- Bug整理——$(window).height()获取到$(document).height()的问题
想看解决方案不想看无聊乏味的bug解决过程的同学,请直接跳转到页面底部~ 今天在做项目的过程中遇到了一个BUG,项目中需要获取到浏览器客户区的高度以方便做一些适应性调整,代码如下: $(documen ...
- window.onload、DOMContentLoaded和$(document).ready()
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C ...
- window.onload与$(document).ready()区别
2013-12-08 17:11:34 window.onload一次只能执行一个程序,而$(document).ready()可以按照先后顺序执行多个程序. eg: function one(){ ...
- $(document).ready(){}、$(fucntion(){})、(function(){})(jQuery)onload()的区别
1.首先说JQuery的几个写法 $(function(){ //do someting }); $(document).ready(function(){ //do so ...
随机推荐
- bash 中的case语法
CASE语法格式备忘 case $variable-name in pattern1) command1 ... .... commandN ;; pattern2|pattern3|pattern4 ...
- Problem:Minesweeper Master
Google code jam Qualification Round 2014 题目链接:https://code.google.com/codejam/contest/dashboard?c=29 ...
- Java POI操作Excle工具类
用到了jxl.jar和poi.jar 一些基本的操作Excel的操作方法: import java.io.File; import java.io.FileInputStream; import ja ...
- 【wpf WebBrowser 清空网站的Cookie&Session 清空用户登录状态】
最近做项目遇到了一个说小不小,说大不大的问题,那就是在WebBrowser中清空网站上用户的登陆状态, 一开始心想,那不就清空cookies就行啦,那么简单的事情,百度一下 …… …… 是的,正如你们 ...
- a标签中使用img后的高度多了4px
前两天,在做一个网站的时候,发现a标签中使用img后的高度多了4px,各种纠结. 最后,仔细分析,终于找到原因了,因为img是行内元素,默认display: inline; 它与文本的默认行为类似,下 ...
- sql server 中 syscolumns 各个字段的意义
列名 数据类型 描述 name sysname 列名或过程参数的名称. id int 该列所属的表对象 ID,或与该参数关联的存储过程 ID. xtype tinyint systypes 中的物理存 ...
- HttpContext 讲解
HttpContext类:封装有关个别HTTP请求的所有HTTP特定的信息,又叫上下文.看到这个解释,我觉得有些抽象,Http特定信息具体又是什么?看了下备注:为继承 IHttpModule 和 IH ...
- iOS 通过tag查找控件
//比如创建一个UIImageView到view上 UIImageView *imageView = [[UIImageView allc] init]; imageView.tag = 10001; ...
- AMQ学习笔记 - 20. 使用Apache ActiveMQBrowser监控ActiveMQ
概述 Apache ActiveMQBrowser可以用于查看AMQ中的消息.这里对其使用方法进行简单介绍. 使用介绍 1.下载并解压缩 下载地址:Apache ActiveMQBrowser,当前最 ...
- Linux开机启动程序详解[转]
Linux开机启动程序详解 我们假设大家已经熟悉其它操作系统的引导过程,了解硬件的自检引导步骤,就只从Linux操作系统的引导加载程序(对个人电脑而言通常是LILO)开始,介绍Linux开机引导的步骤 ...