Help - Search - Members - Calendar
Full Version: Generating Pop Up
Zymic Webmaster Forums > Web Design & Development > Client Side Scripting > JavaScript
P3D1G0
How's it going? So I was needing a little script that doesn't just generate a pop up, but when the link is clicked, the pop up appears and as well, it will direct the user to a new page. I don't have an example but know I've seen it other places.

I use a code similar to this:
CODE
<a href="http://www.yourweblog.com/yourfile.html" onclick="window.open('http://www.yourweblog.com/yourfile.html','popup','width=500,height=500,
scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,stat
us=no,left=0,top=0'); return false">About</a>


But have also looked at scripts where the javascript is included in the header. I'm not sure what would be a better source?
jack2012
I need more information. As it could be adware or a spyware or even a scareware.

1) Go to IE or your Web Browser>Tools>Internet Options>Security tab>Click on Restricted Sites icon>Click on Sites>Under 'Add This Website to the Zone', Type >Add>Close>OK.Url that is trust onto your IE>Add>Close>OK.

2) IE>Tools>Manage Add On>Click on Toolbars Extensions>Disable any unknown add on. (Make sure that all add on is chosen at the bottom left of the page).


_______________________________________________________________________
homeowners association management best forex system
jer-k
You could do this..

In the <head> section create a function to generate a popup rather than have a massive chunk of code in the link itself.. such as:

CODE
function launchPopup(url){
   window.open(url, 'popup', 'width=500, height=500, scrollbars=no, resizable=no, toolbar=no, directories=no, location=no, menubar=no, status=no, left=0, top=0');
}


Now for the link.. far less cumbersome:

CODE
<a href="http://www.yourweblog.com/yourfile.html" onclick="launchPopup('http://www.yourweblog.com/yourPOPUPfile.html')">About</a>


Notice i removed the "return false" from the link, as that would disable the original link from loading the "yourfile.html".

This is all assuming that i have correctly understood you and you want both the main page to change AND for a popup to be generated?

Other stuff you could now do with this would be to allow the function to take more parameters, for instance you may want to define the width and height within the link tag so if you had multiple link instances requiring a popup they could be easily made to vary. Also you could have the function find out the visitors screen size and then using the width/height values sent it could load create the popup in the center of their screen?

Hope this was useful in some way smile.gif

P.S: Popups are horrible! ...just needed to get that off my chest..
jeffreylee
for that you need to read JS tutorials. Once you familiar with that then you may able to use that
EvilMastermindsProgram
Use this:
CODE
<a href="java script:void(0)" onclick="window.open('http://www.yourweblog.com/yourfile.html','popup','width=500,height=500,
scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,stat
us=no,left=0,top=0'); return true;">About</a>

Setting the href attribute of the <a> tag to "java script:void(0)" makes the <a> tag like a button.
It only runs JavaScript when clicked, and does not redirect...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.