以下内容均转载自
这儿,仅供参考,代码本人并未验证使用,先预存于此。
==========================我是分割线======================================
其实B/S的离线很好办,数据在缓存中就可以实现,但如果有数据回调或是数据验证,就不问题了.
所以实现我个人认为有这相几个方法:
方法一:
1)数据缓以数组或XML缓存在客户端的网页中,用JS进行交互;
2)保存时,如果联机就直接保存到服务器,如果断线就保存在网页的XML或JS数组;
3)网络接通时,用XMLHTTP方式将离线数据上传到服务器
方法二:
1)数据缓存到客户端的XML文件,也JS的方式加载到页面;
2)保存时,文件先保存在客户端XML文件,如果网络联机就直接送到服务器,并清空XML;
3)网络接通进,将XML同步到服务器
两种方式都可以实现离线和断电功能;也各有优点,
方法一就是用户不能关闭当前的网站或系统,因为XML可用是以Frame的方隐藏的网页上的,关闭后,数据一样丢失..
方法二需要解决在客户端读写文件的权限与加解密问题;
我个人选择的是方法二,用ActievX + 数字签名 + XML + MD5文件验证实现
<script type="text/javascript" >
function SearchData()
{
var InputParam;
InputParam = document.getElementById('<%= this.UltraWebTab1.FindControl("WebTextEdit1").UniqueID %>').value;
for(var i=0;i<cst10100[0].length;i++)
{
if(cst10100[0][i]==InputParam)
{
igedit_getById('<%= this.UltraWebTab1.FindControl("WebTextEdit2").UniqueID %>').setValue(cst10100[4][i]);
igedit_getById('<%= this.UltraWebTab1.FindControl("WebTextEdit3").UniqueID %>').setValue(cst10100[7][i]);
igedit_getById('<%= this.UltraWebTab1.FindControl("WebTextEdit4").UniqueID %>').setValue(cst10100[5][i]);
igedit_getById('<%= this.UltraWebTab1.FindControl("WebTextEdit5").UniqueID %>').setValue(cst10100[6][i]);
igedit_getById('<%= this.UltraWebTab1.FindControl("WebTextEdit8").UniqueID %>').setValue(cst10100[2][i]);
}
}
var ListBoxControl=document.getElementById('<%= this.UltraWebTab1.FindControl("ListBox1").UniqueID %>');
for(var z=ListBoxControl.options.length;z>0;z--)
{
ListBoxControl.options[z-1].parentNode.removeChild(ListBoxControl.options[z-1]);
}
for(var z=0;z<cst10101[0].length;z++)
{
if (cst10101[0][z]==InputParam)
{
var newOption=document.createElement("OPTION");
newOption.text=cst10101[3][z];
newOption.value=cst10101[3][z];
ListBoxControl.options.add(newOption);
}
}
var dropdownlistControl=document.getElementById('<%= this.UltraWebTab1.FindControl("DropDownList2").UniqueID %>');
for(var z=dropdownlistControl.options.length;z>0;z--)
{
dropdownlistControl.options[z-1].parentNode.removeChild(dropdownlistControl.options[z-1]);
}
for(var z=0;z<cst10101[0].length;z++)
{
if (cst10101[0][z]==InputParam)
{
var newOption=document.createElement("OPTION");
newOption.text=cst10101[1][z];
newOption.value=cst10101[1][z];
dropdownlistControl.options.add(newOption);
}
}
}
//设置时间
var igdrp =igdrp_getComboById('<%= this.UltraWebTab1.FindControl("WebDateChooser1").UniqueID %>');
igdrp.setText('2007-4-11');
//添加节点
for(var z=0;z<cst10104[0].length;z++)
{
var resultId=document.getElementById('<%= this.UltraWebTab1.FindControl("DropDownList1").UniqueID %>');
var newOption=document.createElement("OPTION");
newOption.text=cst10104[1][z];
newOption.value=cst10104[0][z];
resultId.options.add(newOption);
}
</script>
<IE:CLIENTCAPS ID="oClientCaps" style=behavior:url(#default#clientCaps)/>
<script type="text/javascript" >
function getstatus()
{
if(oClientCaps.connectionType=="lan")
return "online";
else
return "offline";
}
function runClock()
{
theTime = window.setTimeout("runClock()", 1000);
status=getstatus();
//if (getstatus() =="online")
//判断本地是否有离线数据,当存在时进行同步
//SyncXML()
}
runClock()
function InsertData()
{
var CommonArry= new Array();
CommonArry[0]= new Array();
CommonArry[0][0]= 'cust';
CommonArry[0][1]= document.getElementById('<%= this.UltraWebTab1.FindControl("WebTextEdit1").UniqueID %>').value; // value
CommonArry[0][2]= "2";
CommonArry[1]= new Array();
CommonArry[1][0]= 'description';
CommonArry[1][1]= document.getElementById('<%= this.UltraWebTab1.FindControl("WebTextEdit8").UniqueID %>').value; // value
CommonArry[1][2]= "2";
CommonArry[2]= new Array();
CommonArry[2][0]= 'DeliveryAddr';
CommonArry[2][1]= document.getElementById('<%= this.UltraWebTab1.FindControl("WebTextEdit2").UniqueID %>').value; // value
CommonArry[2][2]= "2";
CommonArry[3]= new Array();
CommonArry[3][0]= 'PhoneNo';
CommonArry[3][1]= document.getElementById('<%= this.UltraWebTab1.FindControl("WebTextEdit4").UniqueID %>').value; // value
CommonArry[3][2]= "2";
CommonArry[4]= new Array();
CommonArry[4][0]= 'FaxNo';
CommonArry[4][1]= document.getElementById('<%= this.UltraWebTab1.FindControl("WebTextEdit5").UniqueID %>').value; // value
CommonArry[4][2]= "2";
insertData('custinfo',CommonArry);
document.getElementById("KunleneXML").WriteXML("JohnnyOfflineLineXML",doc.xml);
}
</script>
分享到:
相关推荐
1、这是一款网页离线阅读浏览器插件 2、超过 1 千万人使用 Pocket 轻松地保存文章、视频等供以后查看 3、收费只是想让你们知道资源得来不易
Cpp帮助文档/cppreference -zh-20211231.chm 找了好久
VSCODE C/C++ 插件离线包 v0.8.1,放在 %USERPROFILE%\.vscode\extensions 中即可。
linux/Ubuntu离线安装7z工具,解压 后make ,在bin目录生成执行文件
centos7 gcc/g++离线rpm包
ubuntu20.04 gcc/g++离线安装deb包及依赖包(全) 由于生产环境不联网,安装显卡驱动时需要预先安装gcc/g++, 故这里提供了gcc/g++离线安装包及依赖,安装命令简单:sudo dpkg -i ./*.deb
适用Windows10 的HEVC/HEIF/HEIC 离线安装包,方便在Windowns10下查看IOS系统拷贝过来的HEIC格式图片
VS Code插件C/C++ Extension Pack离线安装包
最新opencv源码;最新ffmpeg源码;最新离线opencvDoc文档链接
1.下载后解压缩离线更新包,此离线包适用于 ESET NOD32 安全套装和ESET NOD32防病毒软件4.0版,我们假设您把解压后的文件放在目录D:\\中。 2.通过双击桌面右下角的ESET NOD32图标\打开ESET NOD32的主窗口.直接按F5...
k8s离线文件包 Ubuntu 使用Kubeadm 离线安装k8s 参考连接 https://blog.csdn.net/u010952056/article/details/127276191?spm=1001.2014.3001.5501
JS/HTML格式化离线版 有时网络不方便,对在线JavaScript/HTML格式化工具进行了整理,与大家分享。
一句话搞定gcc安装,操作步骤参考readme.txt文件
webpy.org网站离线文件chm,适合离线学习查阅;目录有部分乱码,正文正常显示;包括: get started: install tutorial learn more: api reference cookbook code examples
(1) 对于同一个用户B,一次性拉取所有用户发给ta的离线消息,再在客户端本地进行发送方分析,相比按照发送方一个个进行消息拉取,能大大减少服务器交互次数; (2) 按需拉取,是无线端的常见优化; (3) 分页拉取,是...
antv g6框架离线引用js包
zabbix snmp redhat7/centos7 离线安装包zabbix snmp redhat7/centos7 离线安装包zabbix snmp redhat7/centos7 离线安装包
FreeRTOS离线参考手册/FreeRTOS离线参考手册/FreeRTOS离线参考手册/FreeRTOS离线参考手册/FreeRTOS离线参考手册
cplusplus.com网站的离线版
博文配套的源码,初稿,用java调用科大讯飞的离线语音识别dll实现离线识别,只要路径对了,就绝对能运行,跟机型无关,操作系统windows