神剑山庄资源网 Design By www.hcban.com
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.

效果图:

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

复制代码 代码如下:
<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
  f.Close
  Set f=Nothing
  Set fso=Nothing
 Else
  SaveAs
 End If
End Sub
Sub OpenIt
 Dim fso,f
 Set fso=CreateObject("Scripting.FileSystemObject")
 Set f=fso.OpenTextFile(FileName,1)
 MyFrame.MyText.Value=f.ReadAll
 f.close
 Set f=Nothing
 Set fso=Nothing
 DisplayTitle
End Sub
Sub Open()
 If fModif Then
  Select Case Msgbox("The text in the file " & FileName & " has been changed." _
   & vbCrLf & "Do you want to save the changes ?",51,oHTA.ApplicationName)
  Case 6 'Yes
   Save
  Case 7 'No
  Case 2 'Cancel
   Exit Sub
  End Select
 End If
 Dim oDLG
 Set oDLG=CreateObject("MSComDlg.CommonDialog")
 With oDLG
  .DialogTitle="Open"
  .Filter="Scripts|*.vbs;*.hta;*.wsf;*.js|Text Files|*.txt|All files|*.*"
  .MaxFileSize=255
  .Flags=.Flags Or &H1000 'FileMustExist (OFN_FILEMUSTEXIST)
  .ShowOpen
  If .FileName<>"" Then
   FileName=.FileName
   OpenIt
  End If
 End With
 Set oDLG=Nothing
End Sub
Sub NewText
 If fModif Then
  Select Case Msgbox("The text in the file " & FileName & " has been changed." _
   & vbCrLf & "Do you want to save the changes ?",51,oHTA.ApplicationName)
  Case 6 'Yes
   Save
  Case 7 'No
  Case 2 'Cancel
   Exit Sub
  End Select
 End If
 MyFrame.MyText.Value=""
 FileName=""
 DisplayTitle
End Sub

'''''''''''''''
' Drag & Drop '
'''''''''''''''
Sub ChangeIFrame
 'We use an Iframe to allow Drag&Drop
 MyFrame.Document.Body.InnerHTML="<textarea ID=MyText WRAP=OFF onChange" & _
  "='vbscript:parent.fModif=True' onclick='vbscript:parent.HideMenu' " & _
  "style='width:100%;height:100%'></textarea>"
 With MyFrame.Document.Body.Style
  .marginleft=0
  .margintop=0
  .marginright=0
  .marginbottom=0
 End With
 With MyFrame.MyText.Style
  .fontfamily="Fixedsys, Verdana, Arial, sans-serif"
  '.fontsize="7pt"
 End With
 Select Case UCase(MyFrame.location.href)
 Case "ABOUT:BLANK"
  FileName=""
 Case Else
  FileName=Replace(Mid(MyFrame.location.href,9),"/","\") 'suppress file:///
  OpenIt
 End Select
End Sub

'''''''''''''''''''
' Menu management '
'''''''''''''''''''
Sub ShowSubMenu(Parent,Child)
 If Child.style.display="block" Then
  Parent.classname="Menuover"
  Child.style.display="none"
  Set LastChildMenu=Nothing
 Else
  Parent.classname="Menuin"
  Child.style.display="block"
  Set LastChildMenu=Child
 End If
 Set LastMenu=Parent
End Sub
Sub MenuOver(Parent,Child)
 If LastChildMenu is Nothing Then
  Parent.className="MenuOver"
 Else
  If LastMenu is Parent Then
   Parent.className="MenuIn"
  Else
   HideMenu
   ShowSubMenu Parent,Child
  End If
 End If
End Sub
Sub MenuOut(Menu)
 If LastChildMenu is Nothing Then Menu.className="MenuOut"
End Sub
Sub HideMenu
 If Not LastChildMenu is Nothing Then
  LastChildMenu.style.display="none"
  Set LastChildMenu=Nothing
  LAstMenu.classname="Menuout"
 End If
End Sub
Sub SubMenuOver(Menu)
 Menu.className="SubMenuOver"
 'LastMenu.classname="Menuin"
End Sub
Sub SubMenuOut(Menu)
 Menu.className="SubMenuOut"
End Sub

</script>
</head>

<body leftmargin=0 topmargin=0 rightmargin=0>
<TABLE id=MenuTable><TR>
 <TD onclick='ShowSubMenu Me,MyFileMenu'
  onmouseover='MenuOver Me,MyFileMenu'
  onmouseout='MenuOut Me'> File </TD>
 <TD onclick='ShowSubMenu Me,MyEditMenu'
  onmouseover='MenuOver Me,MyEditMenu'
  onmouseout='MenuOut Me'> Edit </TD>
 <TD onclick='ShowSubMenu Me,MyFindMenu'
  onmouseover='MenuOver Me,MyFindMenu'
  onmouseout='MenuOut Me'> Find </TD>
 <TD onclick='ShowSubMenu Me,MyHelpMenu'
  onmouseover='MenuOver Me,MyHelpMenu'
  onmouseout='MenuOut Me'> ? </TD>
 <TD onclick="HideMenu" width=100% border=2></TD>
 </TR></TABLE>
<TABLE ID=MyFileMenu class=submenu style="left=2;display:none;"><TR>
 <TD onclick="HideMenu:NewText"
  onmouseover='Submenuover Me'
  onmouseout='Submenuout Me'> New</TD></TR>
 <TR><TD onclick="HideMenu:open"
  onmouseover='Submenuover Me'
  onmouseout='Submenuout Me'> Open</TD></TR>
 <TR><TD onclick="HideMenu:save"
  onmouseover='Submenuover Me'
  onmouseout='Submenuout Me'> Save</TD></TR>
 <TR><TD onclick="HideMenu:saveAs"
  onmouseover='Submenuover Me'
  onmouseout='Submenuout Me'> Save As</TD></TR>
 <TR><TD><HR></TD></TR>
 <TR><TD onclick="HideMenu:window.close"
  onmouseover='Submenuover Me'
  onmouseout='Submenuout Me'> Quit</TD></TR>
 </TABLE>
<TABLE ID=MyEditMenu class=submenu style="left=30;display:none;"><TR>
 <TD><HR width=50px></TD></TR>
 </TABLE>
<TABLE ID=MyFindMenu class=submenu style="left=60;display:none;"><TR>
 <TD><HR width=50px></TD></TR>
 </TABLE>
<TABLE ID=MyHelpMenu class=submenu style="left=90;display:none;"><TR>
 <TD onclick='HideMenu:msgbox "No help available yet;under construction ;=)"'
  onmouseover='Submenuover Me'
  onmouseout='Submenuout Me'>Help</TD></TR>
 <TR><TD onclick='HideMenu:CreateObject("MSComDlg.CommonDialog").AboutBox'
  onmouseover='Submenuover Me'
  onmouseout='Submenuout Me'>About</TD></TR>
 </TABLE>

<iframe id=MyFrame application=yes scrolling=no onload="ChangeIFrame"></iframe>

<script language=vbscript>
'We can handle a file as a parameter to this HTA
Dim x
FileName=Trim(oHTA.CommandLine)
x=Instr(2,FileName,"""")
If x=Len(FileName) Then
 FileName="" 'No File Loaded
Else
 FileName=Trim(Mid(FileName,x+1))
 OpenIt
End If
</script>
</body></html>

标签:
hta,记事本

神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网 免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com

评论“A notepad made in HTA(hta实现的记事本)”

暂无A notepad made in HTA(hta实现的记事本)的评论...

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。