pop-up window
Hey guys...all i want is a simple pop-up window...heres what i have, but it doesnt work:
<script type="javascript" language="text/javascript">
var popupobj=window.createpopup();
popupobj.show("width=175","height="270");
popupobj.href("http://www.mywebsite.com/weather.html");
</script>
any help would be great (thats in the btw)
thanks
Suzanne posted this at 17:51 — 11th August 2003.
She has: 5,507 posts
Joined: Feb 2000
http://www.zerocattle.com/examples/popUp.html
TonyMontana posted this at 02:44 — 12th August 2003.
They have: 218 posts
Joined: Apr 2001
You have to define the function before you call it.
Also, the window opens in response to an event, like loading, or a button press.
TonyMontana
electricmountain.com
kb posted this at 18:18 — 12th August 2003.
He has: 1,380 posts
Joined: Feb 2002
sorry, i forgot to mention auto-popup
how would i do that
necrotic posted this at 19:08 — 12th August 2003.
He has: 296 posts
Joined: May 2002
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Popup</title>
<script type='text/javascript'>
window.name = "Main";
// this function opens the pop-up window
var newWin;
function Pop(page, name) {
newWin=window.open(page, name, "width = 800,height = 600,directories = no,location = no, menubar = no,resizable = no,scrollbars = no, status = no,toolbar = no,screenX = 0,screenY = 0,top = 0,left = 0");
newWin.focus();
return false;
}
</script>
</head>
<body onLoad='return Pop("http://URL/file", "title_of_window")'>
Pop-up
</body>
</html>
Should work.
[James Logsdon]
Suzanne posted this at 19:09 — 12th August 2003.
She has: 5,507 posts
Joined: Feb 2000
don't do it. really. don't.
it's so not worth it and most people have blocked it out. it's not accessible and non-ad uses are extremely limited, if any can actually be rationalized at all.
necrotic posted this at 19:57 — 12th August 2003.
He has: 296 posts
Joined: May 2002
Do browsers that disabled pop-ups also do it when you click on an anchor that has JS enbeded in it? For example, you have the onLoad, but just in case pop-ups are disabled you can click an anchor that says "Click here if window doesn't open automaticaly" that does Pop() on its own.
[James Logsdon]
TonyMontana posted this at 20:56 — 12th August 2003.
They have: 218 posts
Joined: Apr 2001
Popup-blockers, at least the ones I've used that work well, eliminate all javascript. So people using them will miss out on a lot of content, unless they know how to switch the blocker on and off.
Suzanne posted this at 21:32 — 12th August 2003.
She has: 5,507 posts
Joined: Feb 2000
The best blockers will only block off auto-generated windows. If you click on purpose, it will pop open the window.
TonyMontana posted this at 03:43 — 13th August 2003.
They have: 218 posts
Joined: Apr 2001
Is that the case with the AOL, and Earthlink pop-up blockers also, Suzanne? Other javascript functionality is not affected?
Renegade posted this at 04:10 — 13th August 2003.
He has: 3,022 posts
Joined: Oct 2002
Why would you want to have the content in a popup anyway? Why not just have it displayed on a normal page?
Suzanne posted this at 04:11 — 13th August 2003.
She has: 5,507 posts
Joined: Feb 2000
*usually* they only block new windows that are loaded onload, onunload, et cetera. I haven't tested AOL or Earthlink, but it does clients no service to block all JavaScript when it's just a very specific JavaScript function that is the problem.
TonyMontana posted this at 04:57 — 13th August 2003.
They have: 218 posts
Joined: Apr 2001
'Why would you want to have the content in a popup anyway? Why not just have it displayed on a normal page?'
Because you can show extended or new content without cluttering the main display area. Like when you press 'Read Mail' in IE, you get a new window (aka pop-up) with an independent set of functionality. It's good for that type of thing.
Renegade posted this at 11:40 — 13th August 2003.
He has: 3,022 posts
Joined: Oct 2002
Oh, well the only reason I would use a popup would be to show a bigger version of a thumbnail. And most of the sites that I make don't have thumbnails... :S
kb posted this at 16:01 — 13th August 2003.
He has: 1,380 posts
Joined: Feb 2002
wow...i am very controversial...
the reason i am doing a pop-up is because the website i am running is for a business that is heavily weather-dependent. the main page (index, not the "home") will pop-up a window with the current weather conditions in the area...not advertisment. it only will occur once per visit....nothing annoying
Suzanne posted this at 17:14 — 13th August 2003.
She has: 5,507 posts
Joined: Feb 2000
If the business is heavily weather dependent, use an embedded weather report, not a pop-up window where the information could be blocked or lost.
kb posted this at 17:31 — 13th August 2003.
He has: 1,380 posts
Joined: Feb 2002
i thought about that...but it doesnt' flow with the page
Vincent Puglia posted this at 12:33 — 14th August 2003.
They have: 634 posts
Joined: Dec 1999
Hi Kyle,
What about dHTML, popping a div/layer? Since you are popping a page anyway, you are covering part of the 'main' page -- a div will have the same amount of distraction -- without any of the blockers worry. If your weather info is 'src' dependent, place the content within an iframe and that within a div.
BTW: the AOL browser (ver 8.0) has its blocker everpresent in the status line -- its 2 main features: allows you to view blocked popups and accept pops from a given site.
I suspect blockers will become less effective as soon as people begin putting their ads within divs ala the suggestion above.
Vinny
Where the world once stood
the blades of grass cut me still
JeevesBond posted this at 14:36 — 14th August 2003.
He has: 3,956 posts
Joined: Jun 2002
I agree with Vincent...
Even without the blockers Pop-ups are annoying - whether they hold valid content or not.
Suzanne posted this at 15:13 — 14th August 2003.
She has: 5,507 posts
Joined: Feb 2000
If it's critical to the business, talk to the vendors of weather information -- you may be able to pay a fee to get a customized feed of the weather that you could fit into your design.
Of course, if it's important to the business/site, then it really should be PART OF THE DESIGN, right?
kb posted this at 18:10 — 15th August 2003.
He has: 1,380 posts
Joined: Feb 2002
ok well, i will look into the ILAYER...
well, there is another way, but its over my head. it has to do with parsing XML and displaying it. anybody got any good links to tutorials? i checked some out and i can't follow
Suzanne posted this at 18:17 — 15th August 2003.
She has: 5,507 posts
Joined: Feb 2000
no no no, don't do ILAYER. Really. DIV, SPAN. Not proprietary junk. You can call a DIV a layer, but don't use LAYER or ILAYER tags.
As for the xml, you can write a little php script that makes it into xhtml or html. If you provide the xml, I can probably show you how.
kb posted this at 01:33 — 16th August 2003.
He has: 1,380 posts
Joined: Feb 2002
ok...got shot in the face twice...a two for one...sweet!
XML:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<weather ver="2.0">
<head>
<locale>en_US</locale>
<form>MEDIUM</form>
<ut>F</ut>
<ud>mi</ud>
<us>mph</us>
<up>in</up>
<ur>in</ur>
</head>
<loc id="USGA0028">
<dnam>Atlanta, GA</dnam>
<tm>9:32 PM</tm>
<lat>33.75</lat>
<lon>-84.39</lon>
<sunr>7:00 AM</sunr>
<suns>8:23 PM</suns>
<zone>-4</zone>
</loc>
</weather>
i would prefer PHP if possible (which i think is)...thanks
Suzanne posted this at 01:46 — 16th August 2003.
She has: 5,507 posts
Joined: Feb 2000
Okay, what you want to do is pull out the information between the tags -- what format do you want the weather in?
Also, you'll want to not do this for every page, but maybe pull the feed once an hour or so and update it then.
Assuming you have what you need, you need to build an XSL "translator".
http://zend.com/zend/tut/tutorial-wong3.php
Give me the HTML and I'll show you how it works. Assuming I don't get lost in another power outage.
Post it to the Scripting Forum, though.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.