使用window.open()将表单输入作为参数传递给url中的.php文件

时间:2012-06-18 20:27:55

标签: php html window.open

想使用window.open()将电子邮件地址作为附加到网址的参数传递,但是我挂断了。这就是返回的内容

  

http://app.gogodriver.com/SignupPage.php?email= [对象%20HTMLInputElement]

功能:

function open_app(tryitemail)
{
    window.open("http://app.gogodriver.com/SignupPage.php?email="+tryitemail, "_blank","width=450, height=650");    
}

HTML:

<form id="tryitfree">                                       
    <input class="input" type="text" name="tryitemail" placeholder="Email" size="25" />
    <input type="image" src="images/go-button.png" id="TryItButton" value="email" onClick="open_app(tryitemail)">
</form>

1 个答案:

答案 0 :(得分:0)

这是因为您要发送输入元素,而不是它的值。你应该这样做:

<input type="image" src="images/go-button.png" id="TryItButton" value="email" onClick="open_app(tryitemail.value)">