简体   繁体   English

如何从javascript到html表单的多个参数

[英]how to multiple parameters from javascript to html form

here is the code what i am trying 这是我正在尝试的代码

<script>
 var output = "<table id='e' border><tr><td><input type='text' id=/"t"/></td><td><input type='text' id=/"t1/"></td><td><input type='text1' id=/"t2"/></td><td><input type='text1' id=/"t3"/></td><button onclick=del('"+ divId +"')>delete</button></td></tr></table>";

</script>

<body>
<form method=post action="t.php">
<input type="text" id= ??(from script...)
</body>

what shell i do in order to send parameters from script to form one by one in text field? 为了在文本字段中逐个发送脚本中的参数,我做了什么shell? is there any possibilty? 有可能吗?

Yes, you can get value from input text: 是的,您可以从输入文本中获取价值:

<input type="text" id"yourIDinput" onchange="YouFunctionJavaScript()"/>

<script>
 function YouFunctionJavaScript(){
  var textInput = $("#yourIDinput").val(); // Here you get value
  alert(textInput); // 

}
</script>

It is? 它是?

In php: 在PHP中:

<?php 
if($_POST['submit'])
{
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    //Here you have the text in php variables. You can do whatever you want with them
}
?>

<form method="post" enctype="multipart/form-data" name="form">
    Username: <input type="text" name="user" required>
    Password: <input type="password" name="pass" required>
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM