| View previous topic :: View next topic |
| Author |
Message |
Z3

Joined: 04 Aug 2005 Posts: 4 Location: Swirling æther
|
Posted: Thu Aug 04, 2005 9:19 am Post subject: Pop-up links |
|
|
| 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 |
|
 |
|
|
webmaster Site Admin

Joined: 17 Aug 2004 Posts: 3642 Location: Sweden
|
Posted: Thu Aug 04, 2005 9:35 am Post subject: Re: Pop-up links |
|
|
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 |
|
 |
Phate 500+ Club

Joined: 21 Nov 2004 Posts: 818 Location: 127.0.0.1
|
Posted: Thu Aug 04, 2005 4:46 pm Post subject: Re: Pop-up links |
|
|
| wow, i never knew you could do that! |
|
| Back to top |
|
 |
Z3

Joined: 04 Aug 2005 Posts: 4 Location: Swirling æther
|
Posted: Fri Aug 05, 2005 12:54 am Post subject: Re: Pop-up links |
|
|
| 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 |
|
 |
ReFredzRate 1000+ Club

Joined: 20 Aug 2004 Posts: 2186 Location: Netherlands
|
Posted: Fri Aug 05, 2005 7:45 am Post subject: Re: Pop-up links |
|
|
| I guess it's JavaScript... at least that's what it looks like to me. |
|
| Back to top |
|
 |
Ash 1000+ Club

Joined: 03 Aug 2005 Posts: 1017 Location: England
|
Posted: Fri Aug 05, 2005 8:45 am Post subject: Re: Pop-up links |
|
|
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 |
|
 |
webmaster Site Admin

Joined: 17 Aug 2004 Posts: 3642 Location: Sweden
|
Posted: Fri Aug 05, 2005 12:15 pm Post subject: Re: Pop-up links |
|
|
| 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.  |
|
| Back to top |
|
 |
Z3

Joined: 04 Aug 2005 Posts: 4 Location: Swirling æther
|
Posted: Mon Aug 08, 2005 5:14 am Post subject: Re: Pop-up links |
|
|
| 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 |
|
 |
Phate 500+ Club

Joined: 21 Nov 2004 Posts: 818 Location: 127.0.0.1
|
Posted: Mon Aug 08, 2005 6:53 am Post subject: Re: Pop-up links |
|
|
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 |
|
 |
Z3

Joined: 04 Aug 2005 Posts: 4 Location: Swirling æther
|
Posted: Tue Aug 09, 2005 12:27 am Post subject: Re: Pop-up links |
|
|
| does the second pair of codes you posted need a </a> tag? |
|
| Back to top |
|
 |
Phate 500+ Club

Joined: 21 Nov 2004 Posts: 818 Location: 127.0.0.1
|
Posted: Tue Aug 09, 2005 1:18 am Post subject: Re: Pop-up links |
|
|
| i dont think so |
|
| Back to top |
|
 |
|