当用户的IE设置安全低,而且防火墙,杀毒软件关闭等
则使用JavaScript可以对注册表操作。
var $ = jQuery;
var init = [
'idDrag','idDragB','idDragB_1'
,'idDragB_2','idDragB_3','idDragB_4',
'idDragB_5','idDragC','idDragD'
,'idDragE','idDragF'
];
/**
* ====== 初始信息设置 =========
*/
function printInit(){
for(var i=0;i<11;i++){
printSet(init[i]);
}
}
/**
* ====== 记忆功能设置 =========
*/
function printSet(obj){
var left = readReg(obj+'_left');
var top = readReg(obj+'_top');
left = (typeof(left) == 'undefined') ? '0' : left;
top = (typeof(top) == 'undefined') ? '0' : top;
$('div#'+obj).css('left',left);
$('div#'+obj).css('top',top);
};
/**
* ========= 基础信息设置 ==================
*/
/**
function readReg(key){
try{
var shell = new ActiveXObject("WScript.Shell");
var val = shell
.RegRead ("HKEY_CURRENT_USER"
+"\\Software\\lhfeiPrinter\\"+key);
return val;
}catch(e) {}
}
function writeReg(key,val){
try{
if(key != ''){
var shell = new ActiveXObject("WScript.Shell");
shell.RegWrite ("HKEY_CURRENT_USER\\Software\\lhfeiPrinter\\"+key,val);
}
}catch(e){}
}
[color=indigo]注意:这种操作应用不多。最好不采用。[/color]
则使用JavaScript可以对注册表操作。
var $ = jQuery;
var init = [
'idDrag','idDragB','idDragB_1'
,'idDragB_2','idDragB_3','idDragB_4',
'idDragB_5','idDragC','idDragD'
,'idDragE','idDragF'
];
/**
* ====== 初始信息设置 =========
*/
function printInit(){
for(var i=0;i<11;i++){
printSet(init[i]);
}
}
/**
* ====== 记忆功能设置 =========
*/
function printSet(obj){
var left = readReg(obj+'_left');
var top = readReg(obj+'_top');
left = (typeof(left) == 'undefined') ? '0' : left;
top = (typeof(top) == 'undefined') ? '0' : top;
$('div#'+obj).css('left',left);
$('div#'+obj).css('top',top);
};
/**
* ========= 基础信息设置 ==================
*/
/**
function readReg(key){
try{
var shell = new ActiveXObject("WScript.Shell");
var val = shell
.RegRead ("HKEY_CURRENT_USER"
+"\\Software\\lhfeiPrinter\\"+key);
return val;
}catch(e) {}
}
function writeReg(key,val){
try{
if(key != ''){
var shell = new ActiveXObject("WScript.Shell");
shell.RegWrite ("HKEY_CURRENT_USER\\Software\\lhfeiPrinter\\"+key,val);
}
}catch(e){}
}
[color=indigo]注意:这种操作应用不多。最好不采用。[/color]