It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

Pop-up links

Pop-up links

Postby Z3 on Thu Aug 04, 2005 8:19 am

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?
User avatar
Z3
 
Posts: 4
Joined: Thu Aug 04, 2005 8:10 am
Location: Swirling æther

Postby webmaster on Thu Aug 04, 2005 8:35 am

Hi and welcome to DEVPPL.

But this code between <head> and </head>:
Code: Select all
<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: Select all
<a href="thepage.html">LINK</a>


To:
Code: Select all
<a href="javascript:popUp('thepage.html')">LINK</a>
Last edited by webmaster on Fri Aug 05, 2005 11:11 am, edited 1 time in total.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Phate on Thu Aug 04, 2005 3:46 pm

wow, i never knew you could do that!
Web-Developing since '03
Image
User avatar
Phate
500+ Club
 
Posts: 826
Joined: Sun Nov 21, 2004 4:12 am
Location: 127.0.0.1

Postby Z3 on Thu Aug 04, 2005 11:54 pm

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
User avatar
Z3
 
Posts: 4
Joined: Thu Aug 04, 2005 8:10 am
Location: Swirling æther

Postby ReFredzRate on Fri Aug 05, 2005 6:45 am

I guess it's JavaScript... at least that's what it looks like to me.
ReFredzRate
1000+ Club
 

Postby Ash on Fri Aug 05, 2005 7:45 am

That is java script

so is

Code: Select all
<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.
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby webmaster on Fri Aug 05, 2005 11:15 am

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: Select all
<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. :(
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Z3 on Mon Aug 08, 2005 4:14 am

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?
User avatar
Z3
 
Posts: 4
Joined: Thu Aug 04, 2005 8:10 am
Location: Swirling æther

Postby Phate on Mon Aug 08, 2005 5:53 am

a little something like this:

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


Then, put this where you want the link to take you
Code: Select all
<A NAME="thissection">
<A NAME="diffsection">
Web-Developing since '03
Image
User avatar
Phate
500+ Club
 
Posts: 826
Joined: Sun Nov 21, 2004 4:12 am
Location: 127.0.0.1

Postby Z3 on Mon Aug 08, 2005 11:27 pm

does the second pair of codes you posted need a </a> tag?
User avatar
Z3
 
Posts: 4
Joined: Thu Aug 04, 2005 8:10 am
Location: Swirling æther

Next

Who is online

Users browsing this forum: No registered users and 6 guests