节点网络工具包应用程序和页面显示
Node Webkit App and page displayed
我正在使用Node Webkit创建一个桌面应用程序,以在磁盘上创建一个文件。 它正在工作,但是当我尝试将成功消息发送到页面时,它会重新加载页面,将标题栏更改为索引.html并删除之前的标题。 我做错了什么?
这是代码:
<!DOCTYPE html>
<html lang='en'>
<head>
<title>GPS API Client Builder</title>
<script type="text/javascript">
var nw = require('nw.gui');
//Window Menu
var windowMenu = new nw.Menu({
type: 'menubar'
});
//Help Menu
var helpMenu = new nw.Menu();
// Add to window menu
windowMenu.append(new nw.MenuItem({
label: 'Help',
submenu: helpMenu
}));
//About sub entry
helpMenu.append(new nw.MenuItem({
label: 'About',
click: function() {
alert('I made this!');
}
}));
//Assign window
nw.Window.get().menu = windowMenu;
</script>
</head>
<body>
<h1>GUIApp!</h1>
<!--<script src='script.js' type="text/javascript "></script>-->
<script type="text/javascript ">
var os = require('os');
var os = require('os');
var fs = require('fs');
var content = "";
console.log('estoy en script file');
content += 'This is a test of writing string to a text file' + os.EOL;
content += 'This is a test of writing string to a text file' + os.EOL;
content += 'This is a test of writing string to a text file' + os.EOL;
content += 'This is a test of writing string to a text file' + os.EOL;
console.log('content: ' + content);
//write to file
fs.writeFile('output.txt', content, function(err) {
if (err) {
document.write('Error writing file');
//console.log('error writing');
} else {
document.write('file successfully created');
// console.log('file successfully created');
}
});
</script>
</body>
</html>
它与 write() 方法的性质有关。 它将超越以前的东西。
[http://www.w3schools.com/jsref/met_doc_write.asp][1]
相关文章:
- 使用电话间隙在Android应用程序中显示SQL Lite的数据
- Windows8应用程序(html&Javascript):从图片库(除了文件选择器)显示图像的另一种方式
- angularjs+rails应用程序中未显示模板
- 使用谷歌应用程序脚本从工作表中获取值并将其显示在文本框中
- 谷歌图表在运行应用程序时只能显示一次
- 应用程序在呈现Jquery Mobile之前显示无样式的Html
- 如何下载图像并将其显示在NativeScript应用程序中
- 为我的rails应用程序显示javascript弹出消息
- 无法在Chrome(打包)应用程序上检测到ESC按钮(全屏显示时)
- InvalidOperationException:当应用程序未在UserInteractive模式下运行时显示模式对话
- 在聊天应用程序中显示联机用户
- 如何通过ibmworklight中的sql适配器从db2中检索或显示html页面上的数据?android混合应用程序开发
- 如何在angular js的ng应用程序中以普通的htm显示标签
- React/Node应用程序中的Facebook评论插件.js仅在刷新时显示
- NodeJS应用程序只显示第一个JSON对象.为什么?
- 图书获胜't阅读器应用程序练习显示
- D3图表未在Android混合应用程序中显示
- 我可以使用Firebug来显示应用程序的对象吗?
- 如何在Mvc中显示应用程序的每页中的搜索框
- Digital Publishing Suite Web Viewer未显示应用程序