"tin" <pa****@panservice.it> writes:
i wanna close the old page ONLY when i click on the link which open a new
page.
What's wrong? please help me :)
You tell me! What *is* wrong?
To get qualified help, you need to tell us:
1) What are you doing (inluding which browser you are using).
2) What you expect to happen.
3) What really happens.
You failed to provide the third piece of information, so we have to
run it ourselves and see what happens. Since we don't know which browser
you are using, we might not get the same error.
What error message does your browser give? Mine said something about
an unterminated string literal. That is usually because a string has
been broken onto two lines.
<script language="Javascript">
<!--
function apri (theURL,winName,features){
window.open (theURL,winName,features);
var a=null;
oldwindow = window.self;
oldwindow.opener = window.self;
oldwindow.close();
}
-->
</script>
This script looks operable. A more correct version would be:
<script type="text/javascript">
function apri(theUrl,winName,features) {
window.open(theUrl,winName,features);
window.opener = window;
window.close();
}
</script>
You should know that this script abuses a bug in IE that allows you to
close a browser window that was not opened by the page. That is a bad
thing to do, and can make users very angry. It might also get fixed in
a later version of the browser.
<A
href=javascript:apri('../pagine_popup/page_to_load.html','finestra1','width=
220,height=260','scrollbars=no')>start</a>
This is incorrect HTML. Attributes containing anything except
alphanumeric characters and a few select elements of punctuation
*must* be quoted.
You should also avoid using the javascript
: pseudo protocol.
<URL:http://jibbering.com/faq/#FAQ4_24>
It has potential side effects that you avoid in *this* case, but it is
a bad habit to get. Use the onclick attribute instead. Also notice
that you pass four arguments to a function that only uses three.
<a href="noJS.html"
onclick="apri('../pagine_popup/page_to_load.html','finestra1',
'width=220,height=260,scrollbars=no,resizable=yes' );">
start</a>
If you remove the scrollbars, you should *alway* make the window
resizable. Otherwise, content might be placed outside the visible area
with no way to get to it. Remember that you cannot control the font size
of the users browser if he choses to override it.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'