function addItem() {
var obj = new ActiveXObject("WScript.Shell");
obj.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\TestValue", "1", "REG_SZ");
document.writeln("Written successfully");
var testValue = obj.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\TestValue");
document.writeln("Read successfully");
document.writeln("The value of TestValue is "+testValue);
}
保存为js文件,在html文件中写入代码
function addItem() {
var obj = new ActiveXObject("WScript.Shell");
obj.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\TestValue", "1", "REG_SZ");
document.writeln("Written successfully");
var testValue = obj.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\TestValue");
document.writeln("Read successfully");
document.writeln("The value of TestValue is "+testValue);
}
保存为js文件,在html文件中写入代码包含js文件,并且在body中
就可以了温馨提示:答案为网友推荐,仅供参考