Click to See Complete Forum and Search --> : please help - popup problem :(


Mystical
12-16-2002, 04:38 PM
Hi...

back in the day (like 2001 ;) ) there was a tutorial here under "Beyond HTML --> Javascripting" (www.htmlgoodies.com) that showed ignorant people like myself how to make a popup window. i used that tutorial once, and it was really helpful.

It showed how to make a little window popup (you could adjust the size of the popup window, whether or not it had scrollbars, whether or not it had the toolbars at the top, etc.)... i REALLY need this script at the moment... could someone who can find that tutorial or knows how to do it off the top of their head please help me out?

I remember it was nothing complicated, it wasn't lines and lines of code, i just want it to open a window with no toolbars, scrollbars, etc.... just the window 'borders'... non-resizable. the tutorial explained how to do all of that and more. only thing i remember is how to close the window...:

<A HREF="#" OnClick="window.close()">Close window</A>

Please help me someone

Thanks
~Lorenzo

cjewell
12-16-2002, 04:48 PM
Easy:

<A HREF="somepage" onClick=window.open("<URL>", "<window name>", "resize=yes")>

If you want options to put status bars, scroll bars, height, width, menu bars etc, just do a web search eg "javascript window.open".

NB. I reckon it is sensible to always enable window resizing (as in example above) - this prevents browsers from chopping off bits of the page if you've made it too small.

Charles
12-16-2002, 05:09 PM
<a href="http://www.w3.org/" onclick="window.open(this.href,'child', 'height=300,width=400'); return false">W3C</a>

And see http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1202731 for window geometry details.

Mystical
12-17-2002, 03:16 PM
Thanks a lot for the help

but... both of your suggestions don't just open a popup, they take the main window (where you click to get the popup to open) to a new page too...

i want the page where you click "Open popup window" to stay at that same page, and just a new window to popup and to go to a certain page, you know what i mean? i don't want the original page to go to a different URL or anything

swon
12-17-2002, 03:21 PM
if you don't want a new location set <a href="javascript:;" onClick= etc.

Charles
12-17-2002, 03:22 PM
Yes, cjewell's version will do that but if you follow my example carefully then that will not happen.

<a href="http://www.w3.org/" onclick="window.open(this.href,'child', 'height=300,width=400'); return false">W3C</a>

Charles
12-17-2002, 03:27 PM
Originally posted by swon
if you don't want a new location set <a href="javascript:;" onClick= etc. That will make the page no longer work for persons, like myself, who do not use JavaScript. And it may violate the accessibility laws in your area. Oh, and it has some unpleasent side effects in version 6 browsers. Its use also leads to impotence.

swon
12-17-2002, 03:38 PM
Charles, you're right, for people who do not use JavaScript.
But why you're not using JavaScript?

Charles
12-17-2002, 03:44 PM
I eschew JavaScript because I cannot stand popups and people resizing my window. But, there are plenty of people who cannot use JavaScript because of their disabilities which is why the law has something to say about your method. All tolled, it seems that about 12% of users do not use JavaScript. That's more than Netscape users.

swon
12-17-2002, 03:50 PM
Good reasons, which I agree, but Javascript can makes things easier, if the programmer is not the devil ;-)

Mystical
12-17-2002, 07:16 PM
Originally posted by Charles
Yes, cjewell's version will do that but if you follow my example carefully then that will not happen.

<a href="http://www.w3.org/" onclick="window.open(this.href,'child', 'height=300,width=400'); return false">W3C</a>

but where exactly do i put the "scrollbar=no", "resize=no", etc. and what format do i put it in :(

Charles
12-18-2002, 04:37 AM
Originally posted by Mystical
but where exactly do i put the "scrollbar=no", "resize=no", etc. and what format do i put it in :( See http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1202731 for window geometry details.

And note that my examply will have no scrollbars; nor will it be resizable. All of those geometry attributes will default to 'no'.

cyberchimp
12-18-2002, 05:26 AM
Mystical - you may have noticed that there is a parallel discussion of 'pop-ups' going on in another thread, to which Charles and Swon have both posted, which you may find useful:
http://forums.webdeveloper.com/showthread.php?threadid=1052.

vishu_gupt
12-18-2002, 05:45 AM
HI Mystical,
Use this and your problem will be solved...
-------------------------------
Use this in <HEAD></HEAD> part

<script language="javascript">
function WOpen(FILEURL)
{
window.open(FILEURL , '' ,'menubar=no,toolbar=no,location=no,resizable=no,s
crollbars=no,status=no,width=450,height=200,top=18
6,left=240');
}
</script>
------------------------------------------------
now USE BELOW LINE IN YOUR HYPERLINK

<a href="java script:WOpen('FILEPATH');">Any text here</a>

Charles
12-18-2002, 05:50 AM
Originally posted by vishu_gupt
HI Mystical,
Use this and your problem will be solved...
-------------------------------
Use this in <HEAD></HEAD> part

<script language="javascript">
function WOpen(FILEURL)
{
window.open(FILEURL , '' ,'menubar=no,toolbar=no,location=no,resizable=no,s
crollbars=no,status=no,width=450,height=200,top=18
6,left=240');
}
</script>
------------------------------------------------
now USE BELOW LINE IN YOUR HYPERLINK

<a href="java script:WOpen('FILEPATH');">Any text here</a> So, having read the posts it is you opinion that he should use a method that unnecessarily makes the page inaccessible to 12% of users and that makes him vulnerable to legal action. And also, it doesn't work right in version 6 browsers. My method avoids these problems.