Webmaster Key - Discussion Forums


Welcome, Guest. Please login or register.
Did you miss your activation email?
February 08, 2012, 04:45:58 PM

Login with username, password and session length
Welceome to Forums!

Important information for guests and new members:

In order to understand the full benefits of becoming an active member of this forum, please review the following information on guest and new member restrictions. These forum changes have been prompted by an overwhelming and unreasonable amount of bot postings and incoherent guest spam messages. We wish to prevent these events from happening in the future and make our community a more comfortable place for all of our members.

For guests:

Guests are not allowed to open new topics, polls, or posts attachments.
If you wish to open up new discussions on this forum, we encourage you to register.

For new members:

New members with less than five posts are not allowed to modify additional profile information such as avatars, contact information, biographies, and signatures. However, new members are encouraged to post their own topics or reply to topics initiated by other members. Become active on the forums and 5 posts should be an easy task!

We are a diverse community with members from all over the world. We encourage new ideas and interesting conversation. Do not be afraid to post webmaster/computer-related questions or problems, as our active members are always willing to help when they are able. Interested? Join us.

+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ javascript popup problems and how to get more than one to work
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print
Author Topic: javascript popup problems and how to get more than one to work  (Read 4404 times)
klw933s
Guest
« on: September 28, 2003, 03:24:36 PM »

Hi,


I'm creating a site that has more than one customized popup in the same script.  I thought I could just name each popup window inbetween the ().  Like,

function openpopup(1){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup(2){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

and then just reference each one back in there own respected <a href> line.  But it's not letting me do this.  The most I can get, if i mess with it enough, is to get all of my 6 different pop ups to load the same , first page, that i orignally started out with.  any suggestions ?

 
Report to moderator   Logged
islanding
Key Keeper
Sr. Member
****
Posts: 313


I see, But why?


WWW
« Reply #1 on: September 28, 2003, 04:51:12 PM »

Hi
  You can have as many as you want, but be careful as most surfers hate them. The script you show has one flaw, when you name the function.

Code:
function openpopup(1){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup(2){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

Try this, rename the function and call it by the new name.

Code:
function popup1(){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function popup2(){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}
Report to moderator   Logged

The Box said: "Install Win95 or better ..." So I installed Linux.
klw933s
Guest
« Reply #2 on: September 29, 2003, 03:02:13 AM »

thanks,  i've tried as you said.  the page loads with errors still and doesn't let me select the links that lead to the popups.  here is a more complete script:

<script>
function openpopup1(){
var popurl="books.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup2(){
var popurl="music.htm"
winpops=window.open(popurl,"",width=300, height=390,scrollbars=1")}

function openpopup3(){
var popurl="pictures.htm"
winpops=window.open(popurl,"",width=300, height=390,scrollbars=1")}

function openpopup4(){
var popurl="aboutme.htm"
winpops=window.open(popurl,"",width=300, height=390,scrollbars=1")}

function openpopup5(){
var popurl="comics.htm"
winpops=window.open(popurl,"",width=300, height=390,scrollbars=1")}

function openpopup6(){
var popurl="links.htm"
winpops=window.open(popurl,"",width=300, height=390,scrollbars=1")}

function openpopup7(){
var popurl="writing.htm"
winpops=window.open(popurl,"",width=300, height=390,scrollbars=1")}

function openpopup8(){
var popurl="qualifications.htm"
winpops=window.open(popurl,"",width=300, height=390,scrollbars=1")}

</script>


<p><font face="Andy" size="3">Find out what I've been doing:</font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup1()">[Books of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup2()">[Music of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup3()">[Pictures of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup4()">[About Me]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup5()">[Some Comics]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup6()">[Links]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup7()">[My Writing]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup8()">[Essential Qualifications]</a></font></p>

</body>



any more suggestions would be great, thanks.
Report to moderator   Logged
islanding
Key Keeper
Sr. Member
****
Posts: 313


I see, But why?


WWW
« Reply #3 on: September 29, 2003, 11:04:56 AM »

Hay,
  Sorry about that, I should have looked closer to the rest of the script. I have fixed the errors and am posting the script as I tested it. It works fine......... Cool

Code:
<html>
<head>
<title>Script Test Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>
function openpopup1(){
var popurl="books.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup2(){
var popurl="music.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup3(){
var popurl="pictures.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup4(){
var popurl="aboutme.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup5(){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup6(){
var popurl="links.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup7(){
var popurl="writing.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup8(){
var popurl="qualifications.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

</script>

</head>

<body>

<p><font face="Andy" size="3">Find out what I've been doing:</font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup1()">[Books of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup2()">[Music of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup3()">[Pictures of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup4()">[About Me]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup5()">[Some Comics]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup6()">[Links]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup7()">[My Writing]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup8()">[Essential Qualifications]</a></font></p>

</body>
</html>


Be sure that this is in the <head>
Code:
<head>
<title>Script Test Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>
function openpopup1(){
var popurl="books.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup2(){
var popurl="music.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup3(){
var popurl="pictures.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup4(){
var popurl="aboutme.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup5(){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup6(){
var popurl="links.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup7(){
var popurl="writing.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup8(){
var popurl="qualifications.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

</script>

</head>

and this is in the <body>
Code:
<body>

<p><font face="Andy" size="3">Find out what I've been doing:</font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup1()">[Books of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup2()">[Music of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup3()">[Pictures of my Life]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup4()">[About Me]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup5()">[Some Comics]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup6()">[Links]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup7()">[My Writing]</a></font></p>
<p><font face="Andy" size="3"><a href="javascript: openpopup8()">[Essential Qualifications]</a></font></p>

</body>

Good Luck............
Report to moderator   Logged

The Box said: "Install Win95 or better ..." So I installed Linux.
klw933s
Guest
« Reply #4 on: September 30, 2003, 01:47:38 PM »

I'm still learning some of these scripts, but can you please tell me what you did to change the latest post you did.  thanks for your time
Report to moderator   Logged
islanding
Key Keeper
Sr. Member
****
Posts: 313


I see, But why?


WWW
« Reply #5 on: September 30, 2003, 11:31:33 PM »

Hi,
  Did it work for you? I have made red code that was added. I think that was it, without going over it all agian.

<script>
function openpopup1(){
var popurl="books.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup2(){
var popurl="music.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup3(){
var popurl="pictures.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup4(){
var popurl="aboutme.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup5(){
var popurl="comics.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup6(){
var popurl="links.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup7(){
var popurl="writing.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

function openpopup8(){
var popurl="qualifications.htm"
winpops=window.open(popurl,"","width=300, height=390,scrollbars=1")}

</script>
« Last Edit: September 30, 2003, 11:49:45 PM by islanding » Report to moderator   Logged

The Box said: "Install Win95 or better ..." So I installed Linux.
klw933s
Guest
« Reply #6 on: October 01, 2003, 02:36:26 AM »

hey,

thanks , that worked great! 
thanks for all your time and help!
Report to moderator   Logged
islanding
Key Keeper
Sr. Member
****
Posts: 313


I see, But why?


WWW
« Reply #7 on: October 01, 2003, 06:51:00 PM »

Hi,
  Anytime............. Good Luck with your site.
Report to moderator   Logged

The Box said: "Install Win95 or better ..." So I installed Linux.
Pages: [1] Go Up Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print 
+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ javascript popup problems and how to get more than one to work

Jump to:  
« previous next »


Our Partners
RelmaxTOP Ranking System Web Hosting RelmaxTOP Ranking System
Staff Sites
12Noon[12Noon Gallery] Andy[Urgentclick]
Tamuril[Tamuril's Digital Art Exhibit] Sensovision
Powered by MySQL Powered by PHP We are hosted by Relmax Inc. |Our Privacy Policy | Sitemap
Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC
Forum design by Tamuril © 2005.
Valid XHTML 1.0! Valid CSS!