PHP5 exit on input button click

The javascript code to close the window does work in Explorer 8, but does not work using Mozilla/5.0, Google Chrome, Safari. Here’s an excerpt from the code (code alignment lost of course)

<h2>Select Test Application Name</h2>
<p>Please type in Application</p>
<form method=“post” action=“./controller.php”>
<fieldset>
<legend>Question / Task</legend>
<label for=“application”>Application</label>
<input type=“text” name=“application” id=“application” value=“” />
</fieldset>
<fieldset id=“actionbox”>
<legend>Action</legend>
<input type=“submit” value=“Select” name=“Select” />
<input type=“button” value=“Exit” name=“exit” onClick=“javascript:window.close();” />
</fieldset>
<input type=“hidden” name=“switchbase” id=“switchbase” value=“select” />
<input type=“hidden” name=“appkey” id=“appkey” value=“” />
<input type=“hidden” name=“qkey” id=“qkey” value=“” />
</form>

Symptom is screen remains unchanged on “click” on Exit Button (except for explorer).
Everything else works fine (e.g. control goes to controller.php on submit).

What do you think?

This is purely a javascript issue and belongs in the JavaScript forum.

Change

javascript:window.close();

to

window.close();

This is how I accomplished something similar but, with a link:



<a href='' onClick='window.parent.opener.top.location.reload(); window.close();'>Close</a>


Thank you, Michael, for moving this to the proper forum.

Made the change, but still not working. (I do have other javascripts that are working. )

I’m running in a local server under Apache. The doctype is

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>

and here’s the modified button

  	&lt;input type="button" value="Exit" name="exit" onClick="window.close();" /&gt;

This is for my own use, so it is not critical, but …

Was the page opened using JavaScript?

If not then you are not allowed to close it using JavaScript and all browsers except IE will ignore any attempt to do so. IE will instead open a dialog asking your visitor to confirm that they really want to allow your page to close their browser.

felgall,

A-HA!

I generated the page through PHP5. So I’ll give your PHP/mySQL Help link at click.

Thanks