/    Sign up×
Community /Pin to ProfileBookmark

Can someone please help me?

[COLOR=royalblue]Hello yall,
I was just wondering if it is possible in a form, that a button not only submits the form but also can close the window? If someone can help that would be great.

Thanks yall
Tasmanian Devil[/COLOR]

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@JonaMar 29.2003 — <input type=button onclick="this.form.submit(); self.close()" value="Submit">

Or...

<input type=submit onclick="self.close()" value="Submit">
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorApr 22.2003 — Dear Jona~

I tired your methods, and neither one worked, the form was not sent and the window did close. Can you explain why?

Thanks

Tasmanian Devil
Copy linkTweet thisAlerts:
@JonaApr 22.2003 — It works in IE6. Are you sure that didn't work? It works for me.
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorApr 22.2003 — I just found out that I have IE5, is there a way it will work in the older bowsers and in netscape also? People that are viewing my website are using from 4-5 and netscape mostly
Copy linkTweet thisAlerts:
@JonaApr 22.2003 — We could try something like this....

<html><head>

<script>

function exit(){var leave = setTimeout("adios()", 1000);}

function adios(){window.close();}

</script>

</head><body>

<form action="">

<!--etc. form stuff-->

<input type=submit onclick="exit()">

</body></html>
Copy linkTweet thisAlerts:
@JonaApr 22.2003 — Oh, it could also be done this way (I think):

<html><head>

<script>

function exit(){var leave = setTimeout("window.close()", 1000);}

</script>

</head><body>

<form action="">

<!--etc. form stuff-->

<input type=submit onclick="exit()">

</body></html>
×

Success!

Help @Tasmanian_Devil spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...