473,371 Members | 1,693 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,371 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 1820
"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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.