473,554 Members | 3,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript">
<!--
function popitup(percent ){
popup = window.open("", "popDialog","he ight=160,width= 300,scrollbars= no");
popup.document. write("HELLO"+p ercent);
//popup.document. close();
}
// -->
<script>
</HEAD>
<BODY onLoad="popitup (0)">
.....

Arty

Jul 20 '05 #1
3 3592
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="JavaS cript">
<!--
function popitup(percent ){
popup = window.open("", "popDialog","he ight=160,width= 300,scrollbars= no");
popup.document. write("HELLO"+p ercent);
//popup.document. close();
}
// -->
<script>
</HEAD>
<BODY onLoad="popitup (0)">
....

Arty


<html>
<head>
<script language="JavaS cript">

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

child_window.do cument.write("H ELLO" + percent) ;

child_window.do cument.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="JavaS cript">

var child_window = new Object ;
child_window.cl osed = true ;

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

function popup(args) {
if (!child_window. closed) {child_window.c lose() }
child_window =
window.open(arg s,"childwindow" ,"toolbar=no,st atus=no,menubar =no,scrollbars= y
es,resizable=no ,width=300,heig ht=160,top=0,le ft=0") ;

}

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

</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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3461
by: Al Davis | last post by:
Note: I tried cross-posting this message to several newsgoups, including comp.lang.perl.misc, c.l.p.moderated, comp.infosystems.www.authoring.cgi, comp.lang.javascript and comp.lang.php. Nothing appeared on my news server, so I'm trying again - this time posting a separate copy of the message to each group. I'm thinking this should be...
1
4800
by: Allen | last post by:
I am trying to add an additional photo/hyperlink to the company web site (I didn't create it) without any luck. The mouseover feature 'highlights' pics by swapping them with another pic using this command in some type of array. I added the mailbox in the lower left corner (see link below)http://www.aamechanical.com/indextemp.htm but I...
6
1939
by: rick | last post by:
I am new to javascript and would appreciate any help that is offered. The following script does not work in IE (the value (document.quote.qty1.value)is not displayed in the "equiptotal" field). Can anyone tell where I went wrong? The script works fine in Mozilla/Firefox. //The script function recalc() {
6
9232
by: Gordowey | last post by:
Where can I find this DIV effect. go to: http://www.amazon.com Put mouse over the text "See All 32 Product Categories" (Top-Middle)..it will open a window with a cool effect... does anyone know where to find a script with this effect.... thanks
32
1991
by: Don Lancaster | last post by:
In an existing, tested and working program, I have a form entry that simplifies to... <INPUT name ="fp1s" type="text" value=0.000 size=12 > and a button of... <input type="button" value=" Set Amplitude " onclick="setAmplitude (this.form)">
1
2198
by: HACKhalo2 | last post by:
Hello. I want to make a PHP button that's small. Problem is, all my attempts either screwed up the layout or needed MUCH more code than i want to do. The page I'm using is set up with tables, if that helps any My first attempt was to use a <span> tag with a javascript function, which gave me the layout i wanted, but in order to transfer the...
6
2518
by: Mark B | last post by:
I'd like a little window to pop up when a user clicks the hyperlink text "Grade Key": Grade Key Score Range A+ 95% - 100% A 90% - 94% A- 85% - 89% B+ 80% - 84%
0
7570
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...
0
7775
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8008
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...
1
7526
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...
0
6113
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...
0
3525
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1992
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1107
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
808
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...

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.