小编ana*_*99g的帖子

如何使用JavaScript创建文本文件?

我正在尝试使用javascript创建一个文本文件.我尝试了以下代码,但这没有用.请给我一个解决方案.谢谢 .

var fso, file;
fso = new ActiveXObject("Scripting.FileSystemObject");
file = fso.CreateTextFile("c:\\Mytest\test.txt");
file.Close();
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome creation filesystemobject text-files

5
推荐指数
1
解决办法
3万
查看次数

Chrome 扩展:onclick() 事件未触发alert() 弹出窗口

我无法alert()通过onclick()事件触发弹出窗口。

代码

文件清单.json

{
    "name": "Project",
    "version": "1.0.0",
    "manifest_version": 2,
    "description": "Popup when website requires Log in",
    "browser_action":{
        "default_icon":"icon_19.png",
        "default_popup":"Popup.html"
        }
}
Run Code Online (Sandbox Code Playgroud)

文件Popup.html

<html>
<head></head>

<body>
    <div class="plus" onclick="popup()"></div>
    <script src="inline.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

文件inline.js

function popup() {
    var link = document.URL;
    alert("This is the link: (" + link + ")");
}
Run Code Online (Sandbox Code Playgroud)

javascript event-handling google-chrome-extension dom-events google-chrome-app

3
推荐指数
1
解决办法
1万
查看次数