可以.bmp文件存储在一个HTA(HTML / VBScript)的? [英] Can a .BMP file be stored in an HTA (HTML/VBScript)?
问题描述
我注意到在所显示的每个条目左边的图标持有在A标记字符流我的Firefox书签的备份。例如:
I've noticed in a backup of my FireFox bookmarks that the icon which is displayed to the left of each entry is held as a character stream in the A tags. For example:
ICON =数据:图像/ PNG; BASE64,iVBOR [数据删除缩短示例]
rkJggg ==
ICON="data:image/png;base64,iVBOR [data removed to shorten example] rkJggg=="
我有3个BMP文件(2是的4x20(249字节)和1个是102x82(24.7 KB))
,我想这样他们我的HTML应用程序中隐藏不迷路。
I have 3 BMP files (2 are 4x20 (249 bytes) and 1 is 102x82 (24.7 KB))
that I would like to hide within my HTML Application so they don't get lost.
较大的一个如下(如图1次)出现在风格标签3次:
The larger one appears 3 times in the style tag as follows (1 occurrence shown):
<style type="text/css">
#frmMainBody
{background:grey; background-image:url('Background.bmp'); margin:0;
padding:0; font:normal 10pt Microsoft Sans Serif;}
</style>
另外两个出现在VBScript中的子程序如下:
The other two appear in a VBScript subroutines as follows:
Sub Button_Glow
' Highlights a button when the cursor hovers over it.
With Window.Event.srcElement.Style
If .BackgroundColor <> "Lavender" Then
.BackgroundColor = "Lavender"
.BackgroundImage = "url(Glow.bmp)"
.BackgroundPositionY = -2
.BackgroundRepeat = "Repeat-X"
End If
End With
End Sub 'Button_Glow
这可能吗?
推荐答案
HTA是可以打开与任何文本编辑器如记事本编辑+纯文本编辑标记语言。
HTA is a plain text editable markup language which you can open and edit with any plain text editor such as Notepad++.
您 CAN 存储在HTML,CSS等任何图像格式的图像转换为Base64,然后代替
You CAN store ANY image format in HTML, CSS, etc by converting the image to base64, then in place of
<img src="mypath/myimage.bmp" />
<style type="text/css">
foo { background: url(mypath/myimage.bmp); }
</style>
您会把::
<img src="data:image/x-png;base64,iVBORw0KGgoAAAANS....." />
<style type="text/css">
foo { background: url(data:image/x-png;base64,iVBORw0KGgoAAAANS.....); }
</style>
为了使这更容易为你,你可以使用在线工具,将图像转换为这种格式,如一个设在这里>>的转换任何图像到一个Base64字符串&LT;&LT;
使用的工具之一(或写你自己的),找到并Background.bmp转换为Base64,然后修改code的第一个块你张贴这样的(也简称为节省空间)
Using one of the tools (or writing your own), locate and convert 'Background.bmp' to base64, then modify the first block of code your posted like this (also shortened to save space)
<style type="text/css">
#frmMainBody
{background:grey; background-image:url(data:image/x-png;base64,iVBORw0KGgoAAAANS....); margin:0;
padding:0; font:normal 10pt Microsoft Sans Serif;}
</style>
接下来,VBScript的code,定位和转换'Glow.bmp'(像你一样的'Background.bmp'同上),然后修改code块,所以它看起来像这样
Next, for the VBScript code, locate and convert 'Glow.bmp' (same as you did for 'Background.bmp' above), and modify the block of code so it looks like this
Sub Button_Glow
' Highlights a button when the cursor hovers over it.
With Window.Event.srcElement.Style
If .BackgroundColor <> "Lavender" Then
.BackgroundColor = "Lavender"
.BackgroundImage = "data:image/x-png;base64,iVBORw0KGgoAAAANS....."
.BackgroundPositionY = -2
.BackgroundRepeat = "Repeat-X"
End If
End With
End Sub
这篇关于可以.bmp文件存储在一个HTA(HTML / VBScript)的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!