请问怎么利用javascript在本地存储临时信息?

DShadow 2002-06-25 07:40:29
就是在本地机存储一些使用信息,类似cookie的功能.不过需要在web以外访问,cookie好像不能在外部访问吧?
可是好像不能生成文件吧.不知道怎么办了.各位大侠救救我吧.
...全文
210 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
DShadow 2002-07-05
  • 打赏
  • 举报
回复
虽然没有解决,不过给分,谢谢了
playgb 2002-07-04
  • 打赏
  • 举报
回复
正好用得上,谢了
chenzengxi 2002-06-27
  • 打赏
  • 举报
回复
剪贴板的使用:

<HTML>
<HEAD>
<SCRIPT>
var bResult;
// Select the text to be cut. Trailing spaces in a text
// selection in cut events cause the Cut shortcut menu item to
// remain disabled.
function fnLoad() {
var r = document.body.createTextRange();
r.findText(oSource.innerText);
r.select();
}
// Enable the Cut shortcut menu item over the DIV. Cut is disabled by default.
// Once Cut is enabled, Internet Explorer automatically copies the data to the
// clipboard and removes the selected text from the document.
function fnBeforeCut() {
event.returnValue = false;
}
//Assign data in text format to the window.clipboardData object.
//Display the result (Boolean) from the setData method in the input box below.
function fnCut(){
event.returnValue = false;
bResult = window.clipboardData.setData("Text",oSource.innerText);
oSource.innerText = "";
tText.innerText += bResult;
}
// Enable the Paste shortcut menu item over the DIV. Paste is disabled by default.
function fnBeforePaste() {
event.returnValue = false;
}
// Cancel the returnValue in onpaste for the text input, which
// has a default behavior.
function fnPaste() {
event.returnValue = false;
oTarget.innerText = window.clipboardData.getData("Text");
}
</SCRIPT>
</HEAD>

<BODY onload="fnLoad()" TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="fixed" BGCOLOR="#FFFFFF"
LINK="#000000" VLINK="#808080" ALINK="#000000">

<DIV CLASS="clsSource" ID="oSource" onbeforecut="fnBeforeCut()" oncut="fnCut()">
Select and cut this text
</DIV>
<DIV CLASS="clsTarget" ID="oTarget" onbeforepaste="fnBeforePaste()" onpaste="fnPaste()">
Paste the Text Here
</DIV><BR>

<SPAN CLASS="clsData">setData Result: </SPAN>
<INPUT CLASS="clsText" ID="tText" TYPE="text" READONLY VALUE="" SIZE="6" TABINDEX="-1">

</BODY>
</HTML>
Muzhu 2002-06-27
  • 打赏
  • 举报
回复
set jsconn = createobject("ADODB.Connection")
playgb 2002-06-27
  • 打赏
  • 举报
回复
楼上的放在剪贴板的东东怎么用呢, 怎么读出来,写进去呢?
<script language=vbs>
set so=createbject("scripting.filesystemobject")
set file=so.createtextfile(文件名);
file.writeline "文本"
file.close
</script>
westfly 2002-06-27
  • 打赏
  • 举报
回复
如果是想临时跟其它应用程序交换信息,可以放到剪贴板里。
clipboardData.setData("Text", sContent);
weidegong 2002-06-25
  • 打赏
  • 举报
回复
Cookies其实就是保存在下面的文件夹内,不用浏览器照样可以访问--这个是否你说的外部访问?
D:\Documents and Settings\Administrator\Cookies
apple749769 2002-06-25
  • 打赏
  • 举报
回复
你当然可以使用js的cookies功能和它强大的FileSystemObject功能。
qiushuiwuhen 2002-06-25
  • 打赏
  • 举报
回复
web以外访问?
啥子意思?

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧