Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Pop-up links



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> HTML Forum
View previous topic :: View next topic  
Author Message
Z3



Joined: 04 Aug 2005
Posts: 4
Location: Swirling æther

PostPosted: Thu Aug 04, 2005 9:19 am    Post subject: Pop-up links Reply with quote

How does one create a link that pops up a new window that has custom dimentions? For example, you click on a link to a comic, and the page with the comic pops up in a 400x500 pixel window in the center of the screen. What is the code for getting that to work?
Back to top
View user's profile Send private message Visit poster's website
webmaster
Site Admin


Joined: 17 Aug 2004
Posts: 3593
Location: Sweden

PostPosted: Thu Aug 04, 2005 9:35 am    Post subject: Re: Pop-up links Reply with quote

Hi and welcome to DEVPPL.

But this code between <head> and </head>:
Code:
<script>
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=500,left = 440,top = 262');");
}
// End -->
</script>


And change the link from:
Code:
<a href="thepage.html">LINK</a>


To:
Code:
<a href="javascript:popUp('thepage.html')">LINK</a>


Last edited by webmaster on Fri Aug 05, 2005 12:11 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Phate
500+ Club


Joined: 21 Nov 2004
Posts: 818
Location: 127.0.0.1

PostPosted: Thu Aug 04, 2005 4:46 pm    Post subject: Re: Pop-up links Reply with quote

wow, i never knew you could do that!
Back to top
View user's profile Send private message Send e-mail AIM Address
Z3



Joined: 04 Aug 2005
Posts: 4
Location: Swirling æther

PostPosted: Fri Aug 05, 2005 12:54 am    Post subject: Re: Pop-up links Reply with quote

Ah, so i was missing the part in the head. I was wondering why the part in the link I had wasnt working. But wouldnt that code cause all the links that way to be 400x 500? what if you needed different links to be different sizes? Also for the heading code you gave me, is that any specific type of script? javascript? all you have is a </script> at the end
Back to top
View user's profile Send private message Visit poster's website
ReFredzRate
1000+ Club


Joined: 20 Aug 2004
Posts: 2186
Location: Netherlands

PostPosted: Fri Aug 05, 2005 7:45 am    Post subject: Re: Pop-up links Reply with quote

I guess it's JavaScript... at least that's what it looks like to me.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Ash
1000+ Club


Joined: 03 Aug 2005
Posts: 1016
Location: England

PostPosted: Fri Aug 05, 2005 8:45 am    Post subject: Re: Pop-up links Reply with quote

That is java script

so is

Code:
<script language="Javascript1.2">

// ***********************************************
// AUTHOR: WWW.CGISCRIPT.NET, LLC
// URL: http://www.cgiscript.net
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( http://www.cgiscript.net/scripts.htm )
// ***********************************************

message = "Ahem no right clicking please! =)";

function NoRightClick(b) {
   if(((navigator.appName=="Microsoft Internet Explorer")&&(event.button > 1))
   ||((navigator.appName=="Netscape")&&(b.which > 1))){
   alert(message);
   return false;
   }
}
document.onmousedown = NoRightClick;

// -->
</script>

it makes it hard to see the source unless you have a mac.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
webmaster
Site Admin


Joined: 17 Aug 2004
Posts: 3593
Location: Sweden

PostPosted: Fri Aug 05, 2005 12:15 pm    Post subject: Re: Pop-up links Reply with quote

Z3 wrote:
Ah, so i was missing the part in the head. I was wondering why the part in the link I had wasnt working. But wouldnt that code cause all the links that way to be 400x 500? what if you needed different links to be different sizes? Also for the heading code you gave me, is that any specific type of script? javascript? all you have is a </script> at the end


Yes, that is javascript, and I forgot a <script> in the beginning (I've edited it now).

If you want different sizes you just copy the javascript part in the header and paste it and change function popUp(URL) { to function popUp1(URL) {

Then change the sizes and the new link should be:
Code:
<a href="javascript:popUp('thepage.html')">LINK</a>


I'm sure it could be done in a better way then this, but I'm not very good at javascript. Sad
Back to top
View user's profile Send private message Visit poster's website
Z3



Joined: 04 Aug 2005
Posts: 4
Location: Swirling æther

PostPosted: Mon Aug 08, 2005 5:14 am    Post subject: Re: Pop-up links Reply with quote

Well, while im here asking questions anyway, might I also ask how to create links, that rather than take you to a different page, just scroll down to the appropriate part of the page your currently veiwing?
Back to top
View user's profile Send private message Visit poster's website
Phate
500+ Club


Joined: 21 Nov 2004
Posts: 818
Location: 127.0.0.1

PostPosted: Mon Aug 08, 2005 6:53 am    Post subject: Re: Pop-up links Reply with quote

a little something like this:

on your hyperlink, put the code as follows
Code:
<A HREF="#thissection">section one</a>
<A HREF="#diffsection">section two</a>


Then, put this where you want the link to take you
Code:
<A NAME="thissection">
<A NAME="diffsection">
Back to top
View user's profile Send private message Send e-mail AIM Address
Z3



Joined: 04 Aug 2005
Posts: 4
Location: Swirling æther

PostPosted: Tue Aug 09, 2005 12:27 am    Post subject: Re: Pop-up links Reply with quote

does the second pair of codes you posted need a </a> tag?
Back to top
View user's profile Send private message Visit poster's website
Phate
500+ Club


Joined: 21 Nov 2004
Posts: 818
Location: 127.0.0.1

PostPosted: Tue Aug 09, 2005 1:18 am    Post subject: Re: Pop-up links Reply with quote

i dont think so
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> HTML Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap