开发者

Button post HTML

I need to use a button without using a form. How do I make it send post data to the browser?

I am using:

<button style="height: 100px; width: 300px" onClick="parent.location='form1.php'" >开发者_高级运维Fill survey</button>


You'll need to create a form in JavaScript, then submit it. Look at this code

The HTML

<button type="button" onclick="proceed();">do</button> 

The JavaScript code

function proceed () {
    var form = document.createElement('form');
    form.setAttribute('method', 'post');
    form.setAttribute('action', 'http://google.com');
    form.style.display = 'hidden';
    document.body.appendChild(form)
    form.submit();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜