html - 将变量从批处理传递到 html 输入值
问题描述
我需要将一个变量从批处理文件传递给 html 输入值
如果我将 %variable% 设置为 html 输入值,它会返回 %variable% 但不是它的实际值...
我的代码:
<!-- :
:: textSubmitter.bat
@echo off
set "location=bob"
for /f "tokens=1-8 delims=," %%a in ('mshta.exe "%~f0"') do (
set "dossier=%%a"
set "occupation=%%b"
set "lieu=%%c"
set "dated=%%d"
set "datef=%%e"
set "ets=%%f"
set "type=%%g"
set "subdi=%%h"
)
echo "Dossier =%dossier%"
echo "Occupation =%occupation%"
echo "Lieu :=%lieu%"
echo "Date Debut : =%dated%"
echo "Date Fin : =%datef%"
echo "Entreprise : =%ets%"
echo "Type : =%type%"
echo "Subdi : =%subdi%"
pause
goto :EOF
-->
<html>
<head>
<title>Classement chantier</title>
</head>
<body>
<script language='javascript' >
function pipeText() {
var dossier=document.getElementById('dossier').value;
var occupation=document.getElementById('occupation').value;
var lieu=document.getElementById('lieu').value;
var dated=document.getElementById('dated').value;
var datef=document.getElementById('datef').value;
var ets=document.getElementById('ets').value;
var type=document.getElementById('type').value;
var subdi=document.getElementById('subdi').value;
var Batch = new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1);
close(Batch.WriteLine(dossier+','+occupation+','+lieu+','+dated+','+datef+','+ets+','+type+','+subdi));
}
</script>
Dossier : <input type='text' name='dossier' size='25' value='%location%'></input><br>
Occupation : <input type='text' name='occupation' size='25'></input><br>
Lieu : <input type='text' name='lieu' size='25'></input><br>
Date Debut : <input type='text' name='dated' size='25'></input><br>
Date Fin : <input type='text' name='datef' size='25'></input><br>
Entreprise : <input type='text' name='ets' size='25'></input><br>
Type : <input type='text' name='type' size='25'></input><br>
Subdi : <input type='text' name='subdi' size='25'></input><br>
<hr>
<button onclick='pipeText()'>Submit</button>
</body>
</html>
在 html 表单中,变量“%location%”应该返回值“bob”,但它返回“%location%”
<input type='text' name='dossier' size='25' value='%location%'>
请问如何将批处理变量设置为 html 输入值以获取值“bob”?
解决方案
推荐阅读
- ios - 即使从 Storyboard 链接,UICollectionView 自定义单元格的子视图也为零
- javascript - AnimeJS 渐进式填充 SVG 路径
- css - elementRef.style.top = "100px" 不起作用
- sql-server - 带日期的字符串无法加载到 MS SQL
- ms-access - 如何在私有模块中创建公共变量
- parsing - AWK(或类似) - 更改匹配模式下方的 2 行
- unity3d - TextMeshPro 无法引用/显示加载到资源包中的字体资源
- python - 熊猫仅添加带有值的列
- asp.net - 使用证书保护 Soap Web 服务
- python-3.x - 如何分发我的 Python 3.6 应用程序以及 SqueezeTool 中的所有依赖项