2015-07-21 116 views
0

Javascript表单提交除正文部分以外的所有信息。Javascript表单不会在任何内容中发布任何内容

<form action="javascript:;" method="post" enctype="text/plain" onSubmit="this.action='mailto:' 
         +document.getElementById('friend1').value+',' 
         +document.getElementById('friend2').value+',' 
         +document.getElementById('friend3').value+ 
         '[email protected]&subject=Tester and space&body=testit';"> 

<input type="Email" id="friend1" value="" required placeholder="1st friend's email"/><br> 
<input type="Email" id="friend2" value="" required placeholder="2nd friend's email"/><br> 
<input type="Email" id="friend3" value="" required placeholder="3rd friend's email"/><br> 

<input type="submit" value="Send"> 
</form> 

是想改变位于形式“的onsubmit”行动身体的部分内容:

&body=testit 

任何帮助,将不胜感激。提前致谢。 :)

+0

一切正常,期待身体的一部分。提交表格时,身体内没有任何反应。 –

+1

也许它是你的URL中的未编码空白(尝试用“%20”替换“”)?你在不同的浏览器中试过了吗? – JDB

+0

嘿,只是用IE浏览器进行了测试,发现它在那里效果不错,但它在Chrome中无法使用。很奇怪。 –

回答

0

用%20替换主题中的空格。我记得几年前有一个问题。它与编码有关。

&subject=Tester%20and%20space 
+0

嘿,谢谢你的回答,但它不是问题的主体,它的身体。 –

+0

您试过解决方案吗?编辑:我几乎积极,你不应该在mailto的主题空白空间。这就是为什么你可能会得到混合的结果。该字符串在到达body之前终止,这就是为什么它在某些浏览器上缺失。 – dannypaz

+0

在Chrome中试过它,仍然无法正常工作,但它在IE中正常工作。 –

相关问题