javascript-通过其他形式发送值
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了javascript-通过其他形式发送值,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2285字,纯文字阅读大概需要4分钟。
内容图文
![javascript-通过其他形式发送值](/upload/InfoBanner/zyjiaocheng/682/b9d9cc7f3b5b4765ad4aff80d829c019.jpg)
我有多种形式指向数据存储到sql数据库的同一站点.用户必须为每个表单填写一个与表单分开的文本字段.我不明白如何从分隔的文本字段中为每种形式发送相同的值.
<form name="user" action="http://hello.xy/login.php" method="GET">
<input type="text" value="User" name="provider" hidden>
Name: <br/>
<input type="text" value="" name="user_name"><br/>
Email: <br/>
<input type="text" value= "" name="user_email"><br/>
<textarea hidden name="comment" value="value from the form comment"></textarea>
<input type="submit" value="submit">
</form>
<form name="google" action="http://hello.xy/login.php" method="GET">
<input type="text" value="Google" name="provider" hidden>
<textarea hidden name="comment" value="value from the form comment"></textarea>
<input type="image" src="images/logos/google.png" value="submit">
</form>
<form name="twitter" action="http://hello.xy/login.php" method="GET">
<input type="text" value="Twitter" name="provider" hidden>
<textarea hidden name="comment" value="value from the form comment"></textarea>
<input type="image" src="images/logos/twitter.png" value="submit">
</form>
<form name="facebook" action="http://hello.xy/login.php" method="GET">
<input type="text" value="Facebook" name="provider" hidden>
<textarea hidden name="comment" value="value from the form comment"></textarea>
<input type="image" src="images/logos/facebook.png" value="submit">
</form>
分隔的文本字段,但在同一站点上:
<form name="comment" >
<textarea name="input" ></textarea>
</form>
我希望有人能帮助我.
谢谢,
米施
解决方法:
没有JavaScript,就无法同时从两种形式发送数据.
没有JavaScript的解决方案是使用一种形式:
<form action="http://hello.xy/login.php" method="GET">
<textarea name="comment"></textarea>
<label for="user_name">Name</label>
<input type="text" name="user_name" id="user_name">
<label for="user_email">Email</label>
<input type="text" name="user_email" id="user_email">
<button type="submit" name="provider" value="User">Submit</button>
<input type="image" src="images/logos/google.png" name="provider" value="Google">
...
</form>
更新资料
由于您使用的是jQuery,请使用:
<textarea name="comment" class="comment-visible"></textarea>
并以每种形式包括:
<input type="hidden" name="comment" class="comment-hidden">
jQuery的:
$(document).on('input', '.comment-visible', function(){
$('.comment-hidden').val( $(this).val() );
});
内容总结
以上是互联网集市为您收集整理的javascript-通过其他形式发送值全部内容,希望文章能够帮你解决javascript-通过其他形式发送值所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。
来源:【匿名】