我可以在.hta文件中嵌入图标吗? [英] Can I embed an icon to a .hta file?

查看:201
本文介绍了我可以在.hta文件中嵌入图标吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了HTML应用程序(hta文件),并且想知道是否存在一种将图标文件嵌入hta文件本身的方法.

I have written an HTML Application (hta file) and am wondering if there is a way to embed an icon file into the hta file itself.

我看过包含嵌入式图形文件的html电子邮件,有没有办法使用html应用程序和图标来做到这一点?

I have seen html emails that include embedded graphic files, is there any way to do this with html applications and icons?

HTA文件具有HTA:APPLICATION标记,该标记允许您指定图标,但是我只想下载一个文件.我不想有一个外部图标文件.这可能吗?

HTA files have an HTA:APPLICATION tag that allows you to specify an icon, but I want to have only a single file for download. I don't want to have an external icon file. Is this possible?

有关hta文件的更多信息,请参见: HTA文件.

More info on hta files here: HTA files.

推荐答案

我发现了一种设置图标的技巧.

I've found an hack to set the icon.

准备具有以下内容的图标文件 icon.ico 和hta文件 source.hta :

Prepare an icon file icon.ico and an hta file source.hta with the following contents:

<HTML>
<HEAD>
   <SCRIPT>
      path = document.URL;
      document.write(
       '<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="myApp" ICON="'+path+'">');
   </SCRIPT>
</HEAD>
<BODY SCROLL="no">
  Hello, World!
</BODY>
</HTML>

打开命令提示符并键入:

Open a command prompt and type:

copy /b icon.ico+source.hta iconapp.hta

这会将图标和hta连接到一个文件中.

That will concatenate the icon and hta into a single file.

在我的测试案例中,Internet Explorer跳过了图标数据并正确显示了HTML.

In my test case Internet explorer skipped over the icon data and display the HTML correctly.

然后使用javascript将图标的路径设置为.hta文件本身的路径,并加载图标.

The path of the icon is then set to that of the .hta file itself using javascript and the icon is loaded.

我已经在Windows XP SP3,Internet Explorer 8上对此进行了测试.

I have tested this on Windows XP SP3, Internet explorer 8.

这篇关于我可以在.hta文件中嵌入图标吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆