[英]How to display the contents of an html text field in JavaScript?
Revised Question: How can you display the text entered into an html text field in JavaScript? 修订的问题:如何显示在JavaScript中输入html文本字段的文本?
https://jsfiddle.net/bjc7em1w/ https://jsfiddle.net/bjc7em1w/
<tr>
<td id="number1"> (1)</td>
<td> <input type="radio" name="radio1" id="standardA1"> </td>
<td> <input type="radio" name="radio1" id="standardI1"> </td>
<td id="standard1">Describe the reason for the development of
the plan and its annexes.</td>
<td> <input type="text" id="comments1"> </td>
</tr>
Since the discription of the problem was rather confusing to read, I will answer just the question: 由于问题的描述非常难以理解,因此我将仅回答以下问题:
var text = document.querySelector("#textbox").value;
alert("The textbox value is: " + text);
If you have any questions about this or want me to elaborate please say so. 如果您对此有任何疑问或希望我详细说明,请这么说。
If I understand correctly, you are looking to add feedback messages related to your form. 如果我理解正确,那么您正在寻求添加与您的表格相关的反馈消息。 You can add an empty span tag to the section where you want the message to display and call it on blur.
您可以在要显示消息的部分添加一个空的span标签,并在模糊时调用它。
For example, add something like: 例如,添加如下内容:
<tr>
<td id="number1"> (1)</td>
<td> <input type="radio" name="radio1" id="standardA1"> </td>
<td> <input type="radio" name="radio1" id="standardI1"> </td>
<td id="standard1">Describe the reason for the development of the
plan and its annexes.</td>
<td> <input type="text" id="comments1" onblur="message()">
<span class="message" id="message"></span>
</td>
</tr>
When the user leaves the section calling onblur, the message can be called like this: 当用户离开调用onblur的部分时,可以像这样调用消息:
function message() {
document.getElementById("message").innerHTML = "message written here";
}
You can add functionality to determine when and how the message is shown. 您可以添加功能来确定何时以及如何显示消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.