【发布时间】:2023-05-06 14:35:02
【问题描述】:
大家早上好,
我目前正在编写一个小批量/jscript/hta 程序。
在下面的程序中,我读取了一个文本输入字段,将文本传递给批处理并在那里显示:
<!-- :: Batch section
@echo off
setlocal
for /F "delims=" %%a in ('mshta.exe "%~F0"') do set "result=%%a"
echo End of HTA window, reply: "%result%"
pause
goto :EOF
-->
<HTML>
<HEAD>
<HTA:APPLICATION SCROLL="no" SYSMENU="no" >
<TITLE>HTA Buttons</TITLE>
<SCRIPT language="JavaScript">
window.resizeTo(374,400);
function myFunction() {
var x = document.getElementById("myText").value;
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.GetStandardStream(1).WriteLine(x);
window.close();
}
</SCRIPT>
</HEAD>
<BODY>
<h3>A demonstration of how to access a Text Field</h3>
<input type="text" id="myText" value="0123">
<p>Click the "Login" button to get the text in the text field.</p>
<button onclick="myFunction()">Login</button>
</BODY>
</HTML>
效果很好。
现在我的问题是: 如何读取两个文本输入字段并将它们传递给批处理? 我总是在 Jscript 中遇到错误!
先谢谢了,我希望有人能帮助我。
【问题讨论】:
标签: javascript html batch-file jscript hta