开发者

How to delete piece of HTML using JavaScript

I have a form and I want it to not be displayed on submit - how is this possible? :)

<body>
<form method="POST" action="test.p开发者_如何学运维hp" name="_navn">
<input name="txt" id="input" type="text" value="Write here" onFocus="noValue()" onBlur="changeValue()">
<input type="submit" value="Submit">
<input type="hidden" name="_submit_check" value="1">
</form>
</body>

This is what I want to go away when the hidden input is submitted. How? :)

(the <body>-tags are not part of what I want to be deleted hehe)


you just want the form and everything in it off the page?

var f = document.getElementsByTagName('form')[0];
f.parentNode.removeChild(f);

otherwise you can just hide it with

f.style.visibility = 'hidden'

or

f.style.display = 'none';
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜