자 바스 크 립 트 레 지 스 트 수정 방법
이 인 스 턴 스 는 주로 RegWrite 방법 을 사용 하 였 으 며,다음은 이 방법 에 대해 상세 하 게 소개 할 것 입 니 다.
RegWrite 방법 은 레 지 스 트 에 지정 한 키 나 값 을 설정 하 는 데 사 용 됩 니 다.문법 형식 은 다음 과 같 습 니 다.
WshShell.RegWrite strName, anyValue, [strType]
매개 변수 설명l strName:레 지 스 트 의 키 나 값 을 지정 하 는 데 사 용 됩 니 다.strName 이 크로스 바(가운데/)로 끝나 면 이 방법 은 키 를 설정 합 니 다.그렇지 않 으 면 값 을 설정 합 니 다.strName 인 자 는 루트 키 로"HKEYCURRENT_USER”、 “HKEY_LOCAL_MACHINE”、“HKEY_CLASSES_ROOT”、“HKEY_USERS"또는"HKEYCURRENT_CONFIG 시작.
l AnyValue:레 지 스 트 의 키 나 값 을 지정 하 는 데 사 용 됩 니 다.strType 이 REG 일 때SZ 또는 REGEXPAND_SZ 시 RegWrite 방법 은 anyValue 를 문자열 로 자동 으로 변환 합 니 다.strType 이 REG 이면DWORD 는 anyValue 를 정수 로 변환 합 니 다.strType 이 REG 이면BINARY,anyValue 는 정수 여야 합 니 다.
l StrType:레 지 스 트 의 키 나 값 을 지정 하 는 데이터 형식 입 니 다.RegWrite 방법 이 지원 하 는 데이터 형식 은 REG 입 니 다.SZ、REG_EXPAND_SZ、 REG_DWORD 와 REGBINARY。다른 데이터 형식 은 strType 으로 전달 되 고 RegWrite 는 E 로 되 돌아 갑 니 다.INVALIDARG。
실현 과정
(1)사용자 정의 함수 작성 PageSetupdel()과 PageSetupset()는 머 릿 말 꼬리 를 비우 고 머 릿 말 꼬리 를 복원 하 는 기능 을 수행 합 니 다.구체 적 인 코드 는 다음 과 같다.
< language=" ">
var HKEY_RootPath="HKEY_CURRENT_USER//Software//Microsoft//Internet Explorer//PageSetup//"; function PageSetup_del()
{
//
try
{
var WSc=new ActiveX ("W .Shell"); HKEY_Key="header";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,""); HKEY_Key="footer";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,"");
}catch(e){}
}
function PageSetup_set()
{
//
try{
var WSc=new ActiveX ("W .Shell"); HKEY_Key="header";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,"&w&b ,&p/&P");
HKEY_Key="footer";
WSc.RegWrite(HKEY_RootPath+HKEY_Key,"&u&b&d");
}catch(e){}
}
</ >
(2)HTML 탭 을 만 들 고 웹 브 라 우 저 컨트롤 을 호출 합 니 다.코드 는 다음 과 같 습 니 다.
< id="WebBrowser" classid="ClSID:8856F961-340A-11D0-A96B-00C04Fd705A2" width="0" height="0">
</ >
(3)"머 릿 말 삭제"와"머 릿 말 복구"의 하이퍼링크 를 만 들 고 사용자 정의 함수 PageSetup 호출del()과 PageSetupset()는 해당 기능 을 실현 합 니 다.코드 는 다음 과 같 습 니 다:
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ="PageSetup_del()"> </a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ="PageSetup_set()"> </a>
(4)관련 인쇄 하이퍼링크 를 구축 하고 웹 브 라 우 저 컨트롤 의 해당 매개 변 수 를 호출 하여 인쇄 미리 보기,인쇄 등 기능 을 실현 합 니 다.코드 는 다음 과 같 습 니 다:
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ="document.all.WebBrowser.Execwb(7,1)"> </a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ="document.all.WebBrowser.Execwb(6,1)"> </a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ="document.all.WebBrowser.Execwb(6,6)"> </a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ="document.all.WebBrowser.Execwb(8,1)"> </a>
총결산위 에서 말 한 것 은 소 편 이 소개 한 자바 스 크 립 트 가 레 지 스 트 를 수정 하 는 방법 입 니 다.여러분 에 게 도움 이 되 기 를 바 랍 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[2022.04.19] 자바스크립트 this - 생성자 함수와 이벤트리스너에서의 this18일에 this에 대해 공부하면서 적었던 일반적인 함수나 객체에서의 this가 아닌 오늘은 이벤트리스너와 생성자 함수 안에서의 this를 살펴보기로 했다. new 키워드를 붙여 함수를 생성자로 사용할 때 this는...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.