Gil*_*ean 8 forms notifications google-chrome google-chrome-extension
是否可以在Webkit HTML桌面通知中使用表单元素?我尝试从Chrome扩展程序中打开HTML通知,<input>我添加了,但我无法输入.我希望能够捕获它的输入并保存它.
var notification = webkitNotifications.createHTMLNotification(chrome.extension.getURL('input-prompt.html'));
notification.show();
<html>
<body>
<form><input type="text" name="here" value="test" /></form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
您可以通过一种非常简单的方式解决这个问题。您可以创建一个用作输入框的 div,并允许编辑该 div 的内容(请参阅此处)。然后你可以使用一个按钮或另一个div作为提交按钮,然后用javascript处理表单提交。
<div contenteditable="true" id="inputBox"></div>
<div id="submitButton" onclick="submitform();">Submit</div>
Run Code Online (Sandbox Code Playgroud)
虽然我同意桌面通知可能不应该包含表单,但我有一个情况,在通知中包含表单实际上更方便。我希望这有帮助。
| 归档时间: |
|
| 查看次数: |
1063 次 |
| 最近记录: |