如何在按钮点击的第4个文本框中显示前3个文本框的值?这只是一个供工作中个人使用的项目。我无法做到正确并且正在寻求专家的帮助。我还附上了页面的图像。notes generator page
以下是我使用的代码:
<main>
<div id="wrapper">
</div>
<div id="content">
<div class="innertube">
<script language="JavaScript">
function showInput()
{
document.getElementById('display').innerHTML =
document.getElementById("user_input").value;}
</script>
<form>
<label><b>CUSTOMER ENQUIRY: </b></label>
<br>
<textarea name="enuqiry" cols="70" rows="3" id="user_input"></textarea>
</form>
<br>
<form>
<label><b>TROUBLESHOOTING: </b></label>
<br>
<textarea name="troubleshooting" cols="70" rows="15" id="user_input2">
</textarea></form>
<br>
<form>
<label><b>RESOLUTION / ADVISE: </b></label>
<br>
<textarea name="troubleshooting" cols="70" rows="3" id="reso"></textarea>
</form>
<br>
<input type="submit" onclick="showInput();"><br/>
<br>
<br>
<label><i>Generated Notes: </i></label>
<p><textarea name="resolution" cols="70" rows="20" span id='display'>
</textarea></span></p>
<button type="reset" value="Reset">Reset</button>
<br>
答案 0 :(得分:0)
<script language="JavaScript">
function concTables()
{
var str;
str = document.getElementById("enuqiry").value + " " +
document.getElementById("troubleshooting").value + ".";
document.getElementById("resolution").innerHTML = str;
</script>
很抱歉,如果我误解了这个问题。这应该允许您将字符串HTML值一起添加。
您的两个文本区域是否具有相同的ID? “故障排除”。你可能想要改变它。此外,您的查询ID拼写为enuqiry,您可能还想更改。
答案 1 :(得分:0)
试试这个..
更新: 输出变量被修改为用户需要
function showInput(){
var ui1 = document.getElementById('user_input').value;
var ui2 = document.getElementById('user_input2').value;
var ui3 = document.getElementById('reso').value;
var out = "CUSTOMER ENQUIRY: " + ui1 + '\n';
out += "TROUBLESHOOTING: " + ui2 + '\n';
out += "RESOLUTION / ADVISE: " + ui3;
document.getElementById('display').innerHTML = out ;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<main>
<div id="wrapper">
</div>
<div id="content">
<div class="innertube">
<form>
<label><b>CUSTOMER ENQUIRY: </b></label>
<br>
<textarea name="enuqiry" cols="70" rows="3" id="user_input"></textarea>
</form>
<br>
<form>
<label><b>TROUBLESHOOTING: </b></label>
<br>
<textarea name="troubleshooting" cols="70" rows="15" id="user_input2">
</textarea></form>
<br>
<form>
<label><b>RESOLUTION / ADVISE: </b></label>
<br>
<textarea name="troubleshooting" cols="70" rows="3" id="reso"></textarea>
</form>
<br>
<input type="submit" onclick="showInput();"><br/>
<br>
<br>
<label><i>Generated Notes: </i></label>
<p><textarea name="resolution" cols="70" rows="20" span id='display'>
</textarea></span></p>
<button type="reset" value="Reset">Reset</button>
<br>