Click to See Complete Forum and Search --> : button to close a window with frames


jambab
04-17-2003, 05:12 AM
HI guys, i'm only a bigginer in java script and i'm looking for a code to proppose a button to click to close a window containing frames. So far all codes i've found work only on a window itself and not when within a frame :

<head>
<script language="JavaScript">
function myClose() {
opener = self;
self.close();
};
</script>
</head>

<body>
<form name="maForm" action="?" method="post">
<input type="button" name="b_close" value="Fermer" onClick="myClose();">
</form>
</body>

Webskater
04-17-2003, 05:28 AM
I've always found that
onclick = "window.close();"
does the job regardless of whether it is on a frames page or not. If it does not work for any reason use
window.parent.close();
if the button is on a frame

jambab
04-17-2003, 05:37 AM
Thanks for you quick answer, but it still didn't work.
To get it work I changed "self" to "top" and it worked just fine.
Thanks anyways ...