WIN764
1.txt(里有两行16个黑方块字符)- ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
- ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇
复制代码 1.hta- <html><head>
- <HTA:APPLICATION
- SCROLL="yes"
- SINGLEINSTANCE="yes"
- >
- <style>
- body {
- font-size:5px;
- line-height:1;
- }
- </style>
- </head><body>
- <iframe src="1.txt" style="width:100%;height:50%;" ></iframe>
- </body></html>
复制代码 通义AI对给予的代码,没有改变。但是执行没有缩小字符,所以求助,希望能将字符缩小。
用了询问vbs解题内容,放弃iframe,通义ai一个解决代码。- <html>
- <head>
- <title>显示1.txt内容</title>
- <HTA:APPLICATION
- APPLICATIONNAME="显示1.txt内容"
- SCROLL="yes"
- SINGLEINSTANCE="yes">
- <style>
- textarea {
- font-size: 10px; /* 调整字体大小 */
- width: 100%;
- height: 90%;
- resize: none;
- }
- </style>
- <script language="VBScript">
- Sub Window_OnLoad()
- Dim objFSO, objFile, strContents
- Set objFSO = CreateObject("Scripting.FileSystemObject")
-
- If objFSO.FileExists("1.txt") Then
- Set objFile = objFSO.OpenTextFile("1.txt", 1)
- strContents = objFile.ReadAll
- objFile.Close
-
- ' 将文本内容按行分割并添加到textarea中
- arrLines = Split(strContents, vbCrLf)
- For Each strLine In arrLines
- txtContent.Value = txtContent.Value & strLine & vbCrLf
- Next
- Else
- MsgBox "1.txt 文件不存在!", vbExclamation, "错误"
- End If
-
- Set objFSO = Nothing
- End Sub
- </script>
- </head>
- <body>
- <textarea id="txtContent" readonly></textarea>
- </body>
- </html>
复制代码
|