首页 > 开发 > HTML > 正文

A notepad made in HTA(hta实现的记事本)

2020-01-29 17:23:31
字体:
来源:转载
供稿:网友
This notepad can handle bigger files than the one shiped with Win9x.
Learn how to make windows looking interfaces in HTML.
Interesting use of Commondialogs.

效果图:


代码如下:
<html><head>

<HTA:APPLICATION
 APPLICATIONNAME="HTANotePad" ID="oHTA" BORDER="thick"
 BORDERSTYLE="normal" CAPTION="yes" CONTEXTMENU="yes"
 INNERBORDER="no" MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes"
 NAVIGABLE="yes"
 ICON="NOTEPAD.EXE" SCROLL="no" SCROLLFLAT="no"
 SELECTION="no" SHOWINTASKBAR="yes" SINGLEINSTANCE="no"
 SYSMENU="yes" VERSION="0.3" WINDOWSTATE="normal">

<STYLE TYPE="text/css">
<!--
BODY { xfont-family: "Verdana, Arial, Helvetica, sans-serif";
  font:menu;
  background-color:Menu;
  color:MenuText;
  xfont-size: 8pt;
  cursor:default; //auto, text, pointer
 }
TABLE { xfont-family:"Arial";
  xfont-size:8pt;
  font:menu;
  padding:0pt;
  border:0pt;
  FILTER: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=90);
 }
IFrame { height:expression(document.body.clientHeight-MenuTable.clientHeight);
  width:100%;
 }
TD { border:"1px solid Menu";}
.submenu {position:absolute;top=20;
  background-color:Menu;
  border="2px outset";}
.MenuIn  {border:'1px inset';}
.Menuover {border:'1px outset';}
.Menuout {border:'1px solid';}
.Submenuover {background-color:highlight;color:highlighttext;}
.Submenuout {background-color:Menu;color:MenuText;}
-->
</STYLE>

<script language=vbscript>
option explicit
Dim FileName,fModif,LastChildMenu,LastMenu
fModif=False 'Not modified
DisplayTitle
Set LastChildMenu=Nothing
Set LastMenu=Nothing
Sub DisplayTitle
 If FileName="" Then
  document.Title="sans titre - " & oHTA.ApplicationName
 Else
  document.Title=FileName & " - " & oHTA.ApplicationName
 End If
End Sub

'''''''''''''''''''
' File management '
'''''''''''''''''''
Sub SaveAs
 Dim oDLG
 Set oDLG=CreateObject("MSComDlg.CommonDialog")
 With oDLG
  .DialogTitle="SaveAs"
  .Filter="Scripts|*.vbs;*.hta;*.wsf;*.js|Text Files|*.txt|All files|*.*"
  .MaxFileSize=255
  .ShowSave
  If .FileName<>"" Then
   FileName=.FileName
   Save
  End If
 End With
 Set oDLG=Nothing
 DisplayTitle
End Sub
Sub Save()
 Dim fso,f
 If FileName<>"" Then
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set f=fso.CreateTextFile(FileName,True)
  f.Write MyFrame.MyText.Value

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表