![](/img/trans.png)
[英]how to get the array from the javascript function to the html form as input field value by body onload() function?
[英]Passing html form's Multiple input value from one input field to a JavaScript event function
我想传递 html 表单的两个输入字段值并通过 JavaScript 将它们连接起来。 当我发送一个值并且 concat 函数采用一个参数时,就可以了。 但是当发送两个值并且 concat 函数接受两个参数时,它会在 concat 函数中打印 << title.value="Undefined" >> 并与 user_name 连接。 我还需要从 user_name 字段传递标题。
<form "method="post"action="signup.php">
<label>Name:</label>
<input type="text" name="title" id="title" />
<br/>
<label>Email:;
<input type="text" name="user_name" id="user_name" onkeyup="concat(this.value,title.value)" />
</form>
用这个。 为表单提供一些名称和 ID 名称,并调用如下所示的 concat 函数。
<form id="form1" name="form1" "method="post"action="signup.php">
<label>Name:</label>
<input type="text" name="title" id="title" />
<br/>
<label>Email:;
<input type="text" name="user_name" id="user_name" onkeyup="concat(this.value, form1.title.value)" />
</form>
将title.value
更改为document.getElementById("title").value
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.