<SCRIPT language=VBScript>
' ------------------------------------------------------
' Stream オブジェクト の作成
Set Stream = CreateObject("ADODB.Stream")
' **********************************************************
' 16進数コード表示
' **********************************************************
function ShowDump()
Dim LineBuffer,DispBuffer,CWork
' ------------------------------------------------------
' Stream のオープン
Stream.Open
' ------------------------------------------------------
' Stream タイプの指定
Stream.Type = 1 ' StreamTypeEnum の adTypeBinary
' ------------------------------------------------------
' 既存ファイルの内容を Stream に読み込む
Stream.LoadFromFile document.all("DumpFile").value
' ------------------------------------------------------
' バイナリ型の Stream オブジェクトからを読み取って加工
DispBuffer = "<PRE style='font-family:""MS ゴシック""'>"
Do while not Stream.EOS
LineBuffer = Stream.Read(16)
For i = 1 to LenB( LineBuffer )
CWork = MidB(LineBuffer,i,1)
Cwork = AscB(Cwork)
Cwork = Hex(Cwork)
Cwork = Ucase(Cwork)
Cwork = Right( "0" & Cwork, 2 )
DispBuffer = DispBuffer & Cwork & " "
Next
DispBuffer = DispBuffer & vbCrLf
Loop
DispBuffer = DispBuffer & "</PRE>"
' ------------------------------------------------------
' Stream を閉じる
Stream.Close
' ------------------------------------------------------
' 結果をセット
document.all("DumpArea").innerHTML = DispBuffer
end function
</SCRIPT>
<HTML>
<BODY>
<INPUT type=file name=DumpFile onChange='Call ShowDump()'>
<DIV id=DumpArea>
</DIV>
</BODY>
</HTML>