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
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>
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]