我正在創建一個小Windows Sidebar小工具,用於在簡單的textarea
中記錄筆記。Windows小工具可以保存數據嗎?
我也像往常一樣,一個gadget.xml
清單文件和文件.html
,見下文。
如何讀取某些數據/保存小工具中的某些數據?
我知道這是不可能的,通常用JavaScript只(注:使用localstorage
是不可能的,因爲我想數據的持久性),所以如何保存/ A Windows Gadget
讀取裏面的數據?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Unicode" />
<title>NeverForget</title>
<style type="text/css">
body
{
margin: 0;
width: 300px;
height: 200px;
background-color: transparent;
}
#gadgetContent
{
width: 100%;
height: 100%;
overflow: hidden;
border: none;
background-color: transparent;
}
</style>
<script type="text/jscript" language="jscript">
function init() {
// how to load notes from a file here on startup?
}
window.onkeydown = function() {
// how to save data to file?
}
</script>
</head>
<body onload="init()">
<textarea id="gadgetContent">Bonjour</textarea>
</body>
</html>
WAW感謝這麼多@mystifeid!這真是太棒了!最後一件事:如何使文本框和身體完全透明?即我們在文本下看到桌面,並且沒有白色/灰色背景。 – Basj
嘗試使用1px x 1px透明png作爲ag:background(請參閱備註[此處](http://msdn.microsoft.com/zh-cn/library/ff486136.aspx)有關如何在html中聲明)然後調整它的大小(例如:imgBackground.style.width =「100%」; imgBackground.style.height =「100%」;) – mystifeid
通過html添加黑色文本或當使用透明的g:background時,普通的javascript方法可能會出現洋紅色。您可以通過添加/刪除文本來解決此問題[g:文本對象](http://msdn.microsoft.com/zh-cn/COM/EN-US /庫/ ff486146.aspx)。這,順便說一句,超出了你原來的問題範圍。請嘗試自己搜索,閱讀並有一個體面的嘗試。如果在幾天之後,您可以不再進步,請提出另一個問題並提供您的css/script/html。 – mystifeid