473,785 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with Window.Open()

I just spent the whole day on solving this problem but still have no
success.

This is what i do:
ModalDialog.win dow = window.open("",
"error",
"toolbar=no,wid th=" + iWidth + ",height="
+ (iHeight + 100) + "," +
"left=" + cx + ",top=" + cy + "," +
"status=no,resi zable=no,modal= yes,dialog=yes" );
ModalDialog.win dow.document.wr ite(wt);
ModalDialog.win dow.document.cl ose();

wt variable contains the actual HTML to be shown:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Izpis</title>
<link rel="stylesheet " type="text/css" href="/inc/styles.css"/>
<link rel="stylesheet " type="text/css" href="/inc/datepicker.css"/>
<script type="text/javascript" src="/inc/xmlextras.php"> </script>
<script type="text/javascript" src="/inc/datepicker.php" ></script>
............
</head>
<body onblur="javascr ipt:focusMe()">
............
<div style="height: 120px; width: 100%; overflow: auto; background-image:
url(/images/layout.jpg); color: white">
............
<script type="text/javascript">
var d = new Date();
var dp = new DatePicker(d, true); <---------------------- Error:
DatePicker is undefined
............
</script>
</div>
............
</body>
</html>

This HTML validates OK except for the onblur event of the body tag.
Note the marked line where i try to construct a new DatePicker object.
It works like a charm in FireFox, but not in IE.
If I save the HTML (wt variable) in test.html, it will work correctly (It's
the SAME HTML). It will also work correctly if used in standard page,
generated by php, but NOT when used with Window.Open().

What am I doing wrong?

Any help would be greatly appreciated.

Thanks,
Jure
Oct 6 '05 #1
6 3041
Jure Erznoznik wrote:
I just spent the whole day on solving this problem but still have no
success.

This is what i do:
ModalDialog.win dow = window.open("",
"error",
"toolbar=no,wid th=" + iWidth + ",height="
+ (iHeight + 100) + "," +
"left=" + cx + ",top=" + cy + "," +
"status=no,resi zable=no,modal= yes,dialog=yes" );
ModalDialog.win dow.document.wr ite(wt);
ModalDialog.win dow.document.cl ose();

wt variable contains the actual HTML to be shown:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Izpis</title>
<link rel="stylesheet " type="text/css" href="/inc/styles.css"/>
<link rel="stylesheet " type="text/css" href="/inc/datepicker.css"/>
<script type="text/javascript" src="/inc/xmlextras.php"> </script>
<script type="text/javascript" src="/inc/datepicker.php" ></script>
...........
</head>
<body onblur="javascr ipt:focusMe()">
Ditch the javascript pseudo protocol, it is unnecessary.

<body onblur="focusMe ();">

...........
<div style="height: 120px; width: 100%; overflow: auto; background-image:
url(/images/layout.jpg); color: white">
...........
<script type="text/javascript">
var d = new Date();
var dp = new DatePicker(d, true); <---------------------- Error:


Presumably DatePicker is defined in the datepicker.php script, but the
script very likely hasn't loaded yet. Put this script element right at
the bottom of the page or run it from window/body onload.

[...]

--
Rob
Oct 6 '05 #2
> Ditch the javascript pseudo protocol, it is unnecessary.

<body onblur="focusMe ();">
I'm sorry, i don't understand. How else would i call focusMe() if not in
onblur event?
What exactly do you mean by javascript pseudo protocol?
Presumably DatePicker is defined in the datepicker.php script, but the
script very likely hasn't loaded yet. Put this script element right at
the bottom of the page or run it from window/body onload.


You are right, it is defined in datepicker.php.
Your assumption about loading seems very plausible.
The script is practically at the bottom.
I will try running it from onload event, will post results.

Thanks,
Jure
Oct 6 '05 #3
Jure Erznoznik wrote:
Ditch the javascript pseudo protocol, it is unnecessary.

<body onblur="focusMe ();">

I'm sorry, i don't understand. How else would i call focusMe() if not in
onblur event?


Using onblur() to keep a window in focus isn't pleasant for users, but
it's your site I suppose...
What exactly do you mean by javascript pseudo protocol?
Element attributes for intrinsic events expect JavaScript by default.
Using a protocol name (like 'javascript:') is intended to tell the
browser that a non-default script language is being used. That useful
if you are using, say, VBScript in your pages.

Since that is so rare, for any of the 'on' events (onclick, onblur,
onmouseover, etc.) just put the javascript in the attribute.

Where the pseudo-protocol is required is when script is the value of an
attribute where it is not expected by default, e.g. for an href attribute:

<a href="javascrip t:showPic();" ... >

But that is universally disliked. If an A element is to be bastardised
that way, it should use an onclick event and the href should actually do
something useful. The onclick should cancel the navigation by returning
false:

<a href="someUsefu lURL.html" onclick="showPi c();return false;" ...>

Presumably DatePicker is defined in the datepicker.php script, but the
script very likely hasn't loaded yet. Put this script element right at
the bottom of the page or run it from window/body onload.

You are right, it is defined in datepicker.php.
Your assumption about loading seems very plausible.
The script is practically at the bottom.
I will try running it from onload event, will post results.

Thanks,
Jure

--
Rob
Oct 6 '05 #4
Jure Erznoznik wrote:
I just spent the whole day on solving this problem but still have no
success.

This is what i do:
ModalDialog.win dow = window.open("", <snip>

When a window is opened with an empty string as its URL parameter the
browser uses "about:blan k" (or an equivalent) as the URL of the new
window.
<script type="text/javascript" src="/inc/xmlextras.php"> </script>
<script type="text/javascript" src="/inc/datepicker.php" ></script>

<snip>

If you document.write a relative URL into a window that has as its base
URL "about:blan k" what would be the absolute URL from which the JS file
is requested?

Richard.
Oct 6 '05 #5
Lee
RobG said:
Where the pseudo-protocol is required is when script is the value of an
attribute where it is not expected by default, e.g. for an href attribute:

<a href="javascrip t:showPic();" ... >

But that is universally disliked. If an A element is to be bastardised
that way, it should use an onclick event and the href should actually do
something useful. The onclick should cancel the navigation by returning
false:

<a href="someUsefu lURL.html" onclick="showPi c();return false;" ...>


I'm going to pick a few nits.

It's really only correct to call it a pseudo-protocol when it is
used in an URI, as in the HREF attribute value. In other cases,
it's really just a statement label.

The javascript: pseudo-protocol does have some uses when used as
intended, rather than for its side-effect of executing a function.
The intended use is that the current page contents are replaced
by the value of the evaluated Javascript expression. For example:

<a href="javascrip t:'<html>Hello, world!</html>'">test</a>

or

window.open("ja vascript:opener .myPageGenerato r('beta')");

This usage does have some significant limitations. Some browsers
may not trust that the generated page is from the same domain, so
it shouldn't be used too casually.

Oct 7 '05 #6
> Using onblur() to keep a window in focus isn't pleasant for users, but
it's your site I suppose...


Well, this is actually a parameter input dialog. I would much rather that
browsers supported REAL dialogs, but since they don't, i have to do it this
way. It only does its job once in FF though. Seems FF has a safeguard
against malware that would prevent user from interacting with the browser
:). In IE it works fine, but the windows clicked still gets the event
(MouseDown), but no MouseUp. It's kinda funny watching a selection start
appearing after this :)
Anyway, the way it's working now, code is only intended to show the user it
would be wise to fill out the parameters for the operation he / she
requested, nothing more.
What exactly do you mean by javascript pseudo protocol?


Element attributes for intrinsic events expect JavaScript by default.
Using a protocol name (like 'javascript:') is intended to tell the browser
that a non-default script language is being used. That useful if you are
using, say, VBScript in your pages.


Thanks for the info. I don't really have much theoretical knowledge about
this.

About the onload a.k.a. DatePicker is undefined:
Thank you very much. The stuff works now when called from onload event :)

Jure
Oct 7 '05 #7

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

Similar topics

0
1100
by: Michal Raburski | last post by:
Hi to everybody :) I use Boa-constructor 0.3.1, wx 2.4 and python 2.3. I'have 2 big problems in my application : 1. My EVT_KEY_UP on wxTextCtrl works only when mouse pointer is on the active window. If i'll move it outside the window (with no clicking) it doesn't work. And if i move mouse pointer back on the window - it works.
4
5901
by: OJ | last post by:
Hi, This works to maximize the window, but wants to load yahoo locally : C:\WINDOWS\Desktop\www.yahoo.com <html> <script type="text/javaScript"> <!-- function test() { qwe = window.open("www.yahoo.com","");
2
4965
by: Dom Nicholas | last post by:
Hi, My question is this : how do I detect from another window which didn't create a new window whether it exists ? For example, is there a window-id's container of some sort that hangs around that I can interrogate ? I would like to find a better way of doing the following. I have a window (call it Win) that creates a new window (call it Win2) using window.open().
5
1549
by: Shawn Modersohn | last post by:
For the script: <script language="JavaScript"> function pullPage(){ var arrayLength=document.teamSelectionF.teamSelectionS.length; var pageNav = new Array(arrayLength); var gotoNum=document.teamSelectionF.teamSelectionS.options.value; pageNav="http://www.tandtsports.com"; pageNav="http://www.tandtsports.com/Cougars.html";
2
23514
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent window to open a child window thru javascript window.open 2) I have some functionality in the child window that changes the data
9
2249
by: Simon Wigzell | last post by:
I have a little asp progress bar window that I open up with javascript, sized and located, all the extras turned off. It works by refreshing itself every second and displaying how much a file upload has progressed. (This is a paid for 3rd party thing so don't ask me to change the way it works!) Even though I have "status=no" in the javascript window.open statment it has a status bar and every second the status bar does its thing where it...
2
2759
by: Sal | last post by:
I wonder if anyone has had problems with the above recently and has managed to solve them. I have opened a new window using window.open which performs as would be expected in both IE and Firefox, but when I then want to close the window using window.close, IE just throws an error message "Permission denied". On further investigation I found that IE threw out this message with window.focus() and window.name even though this did not cause a...
7
1822
by: joecap5 | last post by:
I have a main window from which I want to open a separate side menu window. I then want to create a list of items on that side menu by clicking on the item names in the main window. So far I am able to click on "Open Menu" and have the side menu open. I can then click on Items and have them added to the side menu using the innerHTML method or the node method. The trouble comes in when I try to have the side menu opened automatically...
13
3248
by: amymcdo3 | last post by:
Hi Everyone, I have a popup window that opens when clicking a link. The pop up window asks a question and supplies two buttons, Yes and No. The buttons are images and when the user clicks the button, they will either be linked to another page via the Yes button or they will stay on the same page if they click the No button. The popup window is supposed to close once the Yes or No button is clicked, and it does, however, it ignores the...
1
2030
by: ehud37new | last post by:
this script work fine in IE but not in FireFox where is the problem? here is the script /*------------------------------------------------------------------ File: menu.js Use: Collection of clients functions
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8979
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.