...

View Full Version : Help With Pop Up Pages



Falling-Fast
10-23-2005, 11:15 PM
Hey,

I was wondering if anyone could give the the HTML code to have pop up windows kind of like the ones used on this page: http://www.degrassinetnow.com/

I have been trying to this code

<a href="mypage.html" target="loadedlyrics"
onclick="window.open('mypage.html','loadedlyrics','height=200,
width=200,toolbar=no,directories=no,status=no,
menubar=no,scrollbars=no,resizable=no'); return false;">click here</a>


is this the right one or is there a way to edit to have have the pop ups like the page?

thanks in advance. :)

boxxer03
10-24-2005, 04:11 AM
The link you posted doesn't have any pop-ups. What are you trying to do with the pop-up?

Falling-Fast
10-24-2005, 05:02 AM
I'm trying to do a pop up that you can make with like the links you have within your pages. Like when you click on like hostees or something on that site that I gave. That's the kind of pop up boxes that I want.

_Aerospace_Eng_
10-24-2005, 05:31 AM
You have the right idea. Just adjust the width and height. One thing I would do is make a function.
Put this in between your head tags

<script type="text/javascript">
function openWin(url,wid,hgt){
sw=(screen.width-wid)/2;
sh=(screen.height-hgt)/2;
newwin=window.open(url,'','width='+wid+',height='+hgt+',left='+sw+',top='+sh+',scrollbars=1,menubar= 0,toolbars=0,status=0');
newwin.close();
newwin.focus();
}
</script>

Then put this where you want your link to be on your page.

<a href="mypage.html" target="_blank" onclick="openWin(this.href,'200','200');return false;">click here</a>

boxxer03
10-24-2005, 05:46 AM
pretty much, a pop-up is a pop-up, i mean excluding the fact that you can choose what toolbars they show and they're size. the only problem i'm seeing with your code is that it opens 2 windows. there's 2 ways you could do a basic pop-up window. you can put the code for it in the 'head' section of your page and call on it later or you can do it the way you were doing it. i'll just give you the code for the way you were doing it and if you wanan know how to do it the other way just let me know. so here's the code:



<a href="" onClick="window.open('mypage.html','loadedlyrics','height=200,width=200,scrollbars'); return false;">click here</a>


instead of listing all the things you dont want like 'toolbars=no', etc... you can just put what you do want to show, like above, the scrollbars will only show up if the page is bigger than the size of the pop-up. and you don't need an link in the href="" part because you want to stay at that page and not open a different main page and no target for the same reason. that way it shortens your code big time. if you need anything else, let me know.

_Aerospace_Eng_
10-24-2005, 05:56 AM
Though the href would be better if it had something. The return false on the end of the script prevents the link from going any where if the user has js enabled.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum