我在javascript中有多行字符串。我有输入元素,其值设置为从文件中获取的值。
我无法将输入元素的值设置为此变量的值。
let port="";
let xmlData = fs.readFileSync(xmlFileRW,function(err,data){port=data;});
let xmlFileData = `
<form>
<tr>
<th class="hostid-th-padding">
<b>PORT</b>
</th>
<td class="hostid-td-padding">
<input id="port" type="text" size="7" value=""+port+"" onkeypress="buttonEnable()"></input>
</td>
</tr>
答案 0 :(得分:1)
let port="";
let xmlData = fs.readFileSync(xmlFileRW,function(err,data){port=data;});
let xmlFileData = `
<form>
<tr>
<th class="hostid-th-padding">
<b>${port}</b>
</th>
<td class="hostid-td-padding">
<input id="port" type="text" size="7" value="${port}" onkeypress="buttonEnable()"></input>
</td>
</tr>
`