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

2023-12-08 0 825

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:APPLICATIONAPPLICATIONNAME=\”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 explicitDim FileName,fModif,LastChildMenu,LastMenufModif=False\’Not modifiedDisplayTitleSet LastChildMenu=NothingSet LastMenu=NothingSub DisplayTitleIf FileName=\”\” Thendocument.Title=\”sans titre – \” & oHTA.ApplicationNameElsedocument.Title=FileName & \” – \” & oHTA.ApplicationNameEnd IfEnd Sub


\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’ File management \’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’Sub SaveAsDim oDLGSet oDLG=CreateObject(\”MSComDlg.CommonDialog\”) With oDLG.DialogTitle=\”SaveAs\”.Filter=\”Scripts|*.vbs;*.hta;*.wsf;*.js|Text Files|*.txt|All files|*.*\”.MaxFileSize=255.ShowSaveIf .FileName<>\”\” ThenFileName=.FileNameSaveEnd IfEnd WithSet oDLG=NothingDisplayTitleEnd SubSub Save()Dim fso,fIf FileName<>\”\” ThenSet fso=CreateObject(\”Scripting.FileSystemObject\”)Set f=fso.CreateTextFile(FileName,True)f.Write MyFrame.MyText.Valuef.CloseSet f=NothingSet fso=NothingElseSaveAsEnd IfEnd SubSub OpenItDim fso,fSet fso=CreateObject(\”Scripting.FileSystemObject\”)Set f=fso.OpenTextFile(FileName,1)MyFrame.MyText.Value=f.ReadAllf.closeSet f=NothingSet fso=NothingDisplayTitleEnd SubSub Open()If fModif ThenSelect Case Msgbox(\”The text in the file \” & FileName & \” has been changed.\” _& vbCrLf & \”Do you want to save the changes ?\”,51,oHTA.ApplicationName)Case 6\’YesSaveCase 7\’NoCase 2\’CancelExit SubEnd SelectEnd IfDim oDLGSet 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).ShowOpenIf .FileName<>\”\” ThenFileName=.FileNameOpenItEnd IfEnd WithSet oDLG=NothingEnd SubSub NewTextIf fModif ThenSelect Case Msgbox(\”The text in the file \” & FileName & \” has been changed.\” _& vbCrLf & \”Do you want to save the changes ?\”,51,oHTA.ApplicationName)Case 6\’YesSaveCase 7\’NoCase 2\’CancelExit SubEnd SelectEnd IfMyFrame.MyText.Value=\”\”FileName=\”\”DisplayTitleEnd Sub


\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’ Drag & Drop \’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’Sub ChangeIFrame\’We use an Iframe to allow Drag&DropMyFrame.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=0End WithWith MyFrame.MyText.Style.fontfamily=\”Fixedsys, Verdana, Arial, sans-serif\”\’.fontsize=\”7pt\”End WithSelect Case UCase(MyFrame.location.href)Case \”ABOUT:BLANK\”FileName=\”\”Case ElseFileName=Replace(Mid(MyFrame.location.href,9),\”/\”,\”\\\”) \’suppress file:///OpenItEnd SelectEnd Sub


\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’ Menu management \’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’\’Sub ShowSubMenu(Parent,Child)If Child.style.display=\”block\” ThenParent.classname=\”Menuover\”Child.style.display=\”none\”Set LastChildMenu=NothingElseParent.classname=\”Menuin\”Child.style.display=\”block\”Set LastChildMenu=ChildEnd IfSet LastMenu=ParentEnd SubSub MenuOver(Parent,Child)If LastChildMenu is Nothing ThenParent.className=\”MenuOver\”ElseIf LastMenu is Parent ThenParent.className=\”MenuIn\”ElseHideMenuShowSubMenu Parent,ChildEnd IfEnd IfEnd SubSub MenuOut(Menu)If LastChildMenu is Nothing Then Menu.className=\”MenuOut\”End SubSub HideMenuIf Not LastChildMenu is Nothing ThenLastChildMenu.style.display=\”none\”Set LastChildMenu=NothingLAstMenu.classname=\”Menuout\”End IfEnd SubSub SubMenuOver(Menu)Menu.className=\”SubMenuOver\”\’LastMenu.classname=\”Menuin\”End SubSub SubMenuOut(Menu)Menu.className=\”SubMenuOut\”End Sub


</script></head>


<body leftmargin=0 topmargin=0 rightmargin=0><TABLE id=MenuTable><TR><TDonclick=\’ShowSubMenu Me,MyFileMenu\’onmouseover=\’MenuOver Me,MyFileMenu\’onmouseout=\’MenuOut Me\’> File </TD><TDonclick=\’ShowSubMenu Me,MyEditMenu\’onmouseover=\’MenuOver Me,MyEditMenu\’onmouseout=\’MenuOut Me\’> Edit </TD><TDonclick=\’ShowSubMenu Me,MyFindMenu\’onmouseover=\’MenuOver Me,MyFindMenu\’onmouseout=\’MenuOut Me\’> Find </TD><TDonclick=\’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><TDonclick=\”HideMenu:NewText\”onmouseover=\’Submenuover Me\’onmouseout=\’Submenuout Me\’> New</TD></TR><TR><TDonclick=\”HideMenu:open\”onmouseover=\’Submenuover Me\’onmouseout=\’Submenuout Me\’> Open</TD></TR><TR><TDonclick=\”HideMenu:save\”onmouseover=\’Submenuover Me\’onmouseout=\’Submenuout Me\’> Save</TD></TR><TR><TDonclick=\”HideMenu:saveAs\”onmouseover=\’Submenuover Me\’onmouseout=\’Submenuout Me\’> Save As</TD></TR><TR><TD><HR></TD></TR><TR><TDonclick=\”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><TDonclick=\’HideMenu:msgbox \”No help available yet;under construction ;=)\”\’onmouseover=\’Submenuover Me\’onmouseout=\’Submenuout Me\’>Help</TD></TR><TR><TDonclick=\’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 HTADim xFileName=Trim(oHTA.CommandLine)x=Instr(2,FileName,\”\”\”\”)If x=Len(FileName) ThenFileName=\”\”\’No File LoadedElseFileName=Trim(Mid(FileName,x+1))OpenItEnd If</script></body></html>

您可能感兴趣的文章:

  • 怎么运行用记事本写的java程序
  • 使用Java制作一个简单的记事本
  • 使用记事本编写java程序全过程图解
  • 简单记事本java源码实例
  • VB简易记事本实现代码
  • EXTJS记事本 当CompositeField遇上RowEditor
  • Excel、记事本数据导入到数据库的实现方法
  • python3.5使用tkinter制作记事本
  • Python基于Tkinter实现的记事本实例
  • Android实现记事本功能(26)

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 hta A notepad made in HTA(hta实现的记事本) https://www.u-9.cn/jiaoben/hta/145199.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务