2015-07-21 114 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中正常工作。 –

相關問題