473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

what's wrong??!?!?!

tin

<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>
<A
href=javascript:apri('../pagine_popup/page_to_load.html','finestra1','width=
220,height=260','scrollbars=no')>start</a>
i wanna close the old page ONLY when i click on the link which open a new
page.
What's wrong? please help me :)

daniele
Jul 20 '05 #1
5 1822
"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.'
Jul 20 '05 #2
tin
my browser is IE5.5
3) What really happens.

two new pages appear because i used your code:

<a href ="noJS.html"

onclick="apri('../pagine_popup/page_to_load.html','finestra1','width=220,hei
ght=260,resizable=yes');">
start</a>

and the IE try to open two page: nojs.htm and page_to_load.html but i need
the one opened with the onclick
the old page doesn't close because the link is placed on the center of a
framed page. So i need to close all the frame. How can i do this?
I didn't do the graphical job. That's why i didn't knew that it is a framed
page.

thanks
Jul 20 '05 #3
"tin" <pa****@panservice.it> writes:
my browser is IE5.5
3) What really happens. two new pages appear because i used your code:


Ah, yes. If the closing of the window fails, that would be the effect.
<a href ="noJS.html"

onclick="apri('../pagine_popup/page_to_load.html','finestra1','width=220,hei
ght=260,resizable=yes');">
To prevent the noJS.html file from opening (in which you explain why
your page requires Javascript to work), you add "return false" to the
end of the onclick attribute value. That cancels the click so the href
isn't opened.
and the IE try to open two page: nojs.htm and page_to_load.html but i need
the one opened with the onclick the old page doesn't close because the link is placed on the center of a
framed page.
That explains why it doesn't close.
So i need to close all the frame. How can i do this?


Change the lines:
window.opener = window;
window.close();
to
top.opener=top;
top.close();
That should close the entire frameset.

/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.'
Jul 20 '05 #4
tin
everithing is working
thanks

"Lasse Reichstein Nielsen" <lr*@hotpop.com> ha scritto nel messaggio
news:ek**********@hotpop.com...
"tin" <pa****@panservice.it> writes:
my browser is IE5.5

Jul 20 '05 #5
In article <r8**********@hotpop.com>, Lasse Reichstein Nielsen <lr*@hotpop.com>
writes:
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.


Contrary to beliefs, its not a bug that is limited to IE. It is very
widespread, in many browsers, in some form or another. Whether its closing the
window or closing an active tab in tabbed browsers.
--
Randy
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
5
by: titan0111 | last post by:
#include<iostream> #include<iomanip> #include<cstring> #include<fstream> using namespace std; class snowfall { private: int ft;
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
28
by: Madhur | last post by:
Hello what about this nice way to open a file in single line rather than using if and else. #include<stdio.h> void main() { FILE *nd; clrscr();...
56
by: Cherrish Vaidiyan | last post by:
Frinds, Hope everyone is doing fine.i feel pointers to be the most toughest part in C. i have just completed learning pointers & arrays related portions. I need to attend technical interview on...
46
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
9
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
3
by: Siong.Ong | last post by:
Dear all, my PHP aims to update a MySQL database by selecting record one by one and modify then save. Here are my PHP, but I found that it doesnt work as it supposed to be, for example, when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.