Click to See Complete Forum and Search --> : To create a minimalist window...?


Drewsky
06-30-2006, 12:19 PM
I've looked, but I can't find this information elsewhere. target="_blank" opens a
link in a new window, but how do I make that window one of those simple ones
with only the title bar and a close button? One with no navigation or menu
buttons?

dthurman1432
06-30-2006, 12:35 PM
This is for the link to open the popup:

<a href ="javascript:popUp ('whatever.html')">click here</a>

This needs to go between the script tags:

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=425,left = 650,top = 50');");
}

Charles
06-30-2006, 12:58 PM
This is for the link to open the popup:

<a href ="javascript:popUp ('whatever.html')">click here</a>

This needs to go between the script tags:

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=425,left = 650,top = 50');");
}Bad, very bad and for several reasons. Use instead<a href="whatever.html" onclick="window.open (this.href, 'child', 'height=400,width=300'); return false">Whatever</a>

dthurman1432
06-30-2006, 02:59 PM
Bad, very bad and for several reasons.

Can you elaborate a little. I've never ran into any issues with my above script

the tree
06-30-2006, 03:38 PM
Well really only one big reason, and that is that it wont work for anyone who happens to be browsing without javascript. This covers those who chose not to (because JS can be irritating), those who can't (some disability is requiring them to use a browser that doesn't support scripting) or because they are a robot (crawling your site for a seach engine).

Next is whenever people don't want to click your link in the way that you want them to, I often middle click links so when the href is javascript:something() then all I get is a tab where my browser has failed to open a page for that "address".

Lastly (probably not but meh), is that it's just wrong. The href attribute was never meant for that. Why not do things to the official standards.

M'gye
06-30-2006, 04:00 PM
the tree,
that is very interesting and good advice.Thank you.

Drewsky
06-30-2006, 04:01 PM
Wonderful! Thank you so much. Can you tell me where I might be able to find other useful little tidbits like this?


And by the way:

I often middle click links so when the href is javascript:something() then all I get is a tab where my browser has failed to open a page for that "address".

I hate that! Everyone should use FF and middle-click. It's the future.

Charles
06-30-2006, 04:15 PM
Well really only one big reason, and that is that it wont work for anyone who happens to be browsing without javascript. This covers those who chose not to (because JS can be irritating), those who can't (some disability is requiring them to use a browser that doesn't support scripting) or because they are a robot (crawling your site for a seach engine).

Next is whenever people don't want to click your link in the way that you want them to, I often middle click links so when the href is javascript:something() then all I get is a tab where my browser has failed to open a page for that "address".

Lastly (probably not but meh), is that it's just wrong. The href attribute was never meant for that. Why not do things to the official standards.
Let's add that the original example is an abuse of the evil "eval" function.

Charles
06-30-2006, 04:18 PM
Can you tell me where I might be able to find other useful little tidbits like this?http://www.webdeveloper.com/forum/index.php?

Drewsky
06-30-2006, 04:28 PM
Har har. I saw that coming before I even finished writing my post! I guess what I was
trying to ask was: "Is there a place where these gems have been collected and are
presented in one spot? That is, without me having to use effort to search for them?"

kiwibrit
07-01-2006, 03:38 AM
Many also have kittens worrying about security and javascript, not unreasonably (http://www.esj.com/news/article.aspx?EditorialsID=1922), and so have it disabled.

Skywoolf
07-11-2006, 09:41 AM
Thanks for the code Charles. I have been trying for hours to do that without success until I tried your code.

My purpose is navigating a database.

I am using it on a page where it opens a small window that has just a drop down menu. The result of that drop down menu opens another drop down menu. The result of that opens a page that needs to be bigger as it lists a few sentences, then selecting from that list needs to open a much bigger page. The last two, at least should be resizable with scroll bars.

Can anyone please advise how to resize the window at each stage?

One complication is that the two pages with drop down menus are using ACTION and POST so I don't know how to put this code in the ACTION link.