469,343 Members | 5,478 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

Why is this small Javascript not working ?

Below you will find the first lines of my HTML page.
Why doesn't popup a dialog window ?
I click the Html page which is on my hard disc. A IE 5.5 browser window opens
but not a dialog window inside.

<HTML>
<HEAD>
<TITLE>Test page</TITLE>
<script LANGUAGE="JavaScript">
<!--
function popitup(percent){
popup = window.open("","popDialog","height=160,width=300,s crollbars=no");
popup.document.write("HELLO"+percent);
//popup.document.close();
}
// -->
<script>
</HEAD>
<BODY onLoad="popitup(0)">
.....

Arty

Jul 20 '05 #1
3 3443
On Wed, 27 Aug 2003 10:07:06 +0200, Arthur Connor wrote:
Below you will find the first lines of my HTML page.
Why doesn't popup a dialog window ?


I say you need dialog, so why do you use popup?. I guess you need something
like wrote below.

In head:

function popitup(percent){
if (confirm('Is '+percent+' OK?')) { return true; }
else { return false; }
}

And in body:

<a href="blah.html" onClick="return popitup('99%')">Click me</a>

Hope it helps.

--
Regards, Igor Slyusar.
http://www.slyusar.com [27.08.2003 11:44:13]
Jul 20 '05 #2
Igor Slyusar <me@privacy.net> writes:
function popitup(percent){
if (confirm('Is '+percent+' OK?')) { return true; }
else { return false; }
}


That can be done shorter:

function popitup(percent) {
return confirm("Id "+percent+" OK?");
}

If the only difference between the then-branch and the else-branch
of a condition is true vs. false, you only need one branch, with
the condition in place of the boolean constant.

/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 #3
Arthur Connor wrote in message ...
Below you will find the first lines of my HTML page.
Why doesn't popup a dialog window ?
I click the Html page which is on my hard disc. A IE 5.5 browser window opensbut not a dialog window inside.

<HTML>
<HEAD>
<TITLE>Test page</TITLE>
<script LANGUAGE="JavaScript">
<!--
function popitup(percent){
popup = window.open("","popDialog","height=160,width=300,s crollbars=no");
popup.document.write("HELLO"+percent);
//popup.document.close();
}
// -->
<script>
</HEAD>
<BODY onLoad="popitup(0)">
....

Arty


<html>
<head>
<script language="JavaScript">

function popitup(percent) {
child_window = window.open
("","popDialog","width=300,height=160,left=0,top=0 ,menubar=0,toolbar=0,scrol
lbars=0") ;

child_window.document.write("HELLO" + percent) ;

child_window.document.close() ;

}
</script>
</head>
<body onLoad="popitup(0) ">

</body>
</html>

will open a popup from the main window with "HELLO0" as the content.

Alternatively:-

<html>
<head>
<script language="JavaScript">

var child_window = new Object ;
child_window.closed = true ;

function popclose() {
if (!child_window.closed) {
child_window.close() ;
}
}

function popup(args) {
if (!child_window.closed) {child_window.close() }
child_window =
window.open(args,"childwindow","toolbar=no,status= no,menubar=no,scrollbars=y
es,resizable=no,width=300,height=160,top=0,left=0" ) ;

}

</script>
</head>
<body onLoad="popup('myfile.html')" onUnload="popclose() ">

</body>
</html>

which will open a popup whose content is myfile.html that closes upon the
change of content of the parent (opener) window.

Hope that helps.

Jim

p.s. take a look at:-

http://www.paulspages.co.uk/pcp/151/menu151.htm

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by rick | last post: by
6 posts views Thread by Gordowey | last post: by
1 post views Thread by HACKhalo2 | last post: by
6 posts views Thread by Mark B | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.