473,395 Members | 1,464 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,395 software developers and data experts.

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

Similar topics

5
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...
1
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...
6
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)....
6
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...
32
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="...
1
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...
6
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%...
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: 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
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...
0
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...
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
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...
0
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...

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.