/    Sign up×
Community /Pin to ProfileBookmark

Newbie Needs Help With Popup Windows

I am new to web programming and am creating a site in flash. The person I’m doing the site for wants smaller windows showing information to popup when a button is clicked. I was told to use javascript pop() function. If I write the script for one button it works just fine. My problem is, is I need the function to work on four separate buttons. I am pulling my hair out since I don’t know the language.

Here is the code I put in the index.html page:

<SCRIPT LANGUAGE = “JavaScript”>
function pop() {
window.open(“popup.html”, “”, “height = 400, width = 600, left=100, resizeable = no, top=100”);
window.open(“popup1.html”, “”, “height = 400, width = 600, left=100, resizeable = no,top=100”);
window.open(“popup2.html”, “”, “height = 400, width = 600, left=100, resizeable = no,top=100”);
window.open(“popup3.html”, “”, “height = 400, width = 600, left=100, resizeable = no,top=100”);
}
</SCRIPT>

popup.html should work on the first button, popup1.html should work on the second button and so forth.

To call the script the buttons are written
on (release){
getURL (“JavaScript:pop();”);
}

Written this way all four popup windows open on each button. I do not know how to distinguish which popup to go with which page. I have tried writing the button code with each button having their respective popup# with in the parenthesis of the getURL script.

I have tried using an if statement but not sure I wrote it right because it didn’t work. Also tried a case statement and that didn’t work.

Hope this makes sense. If anyone could please help I’d greatly appreciate it.

Thank you.
Samel

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@David_HarrisonApr 16.2004 — Have this for your button code and change the arguement of the function to whatever page you want to open:

<i>
</i>
on (release){
getURL ("JavaScript:pop('popup2.html');");
}

Then have this as your JavaScript code:

<i>
</i>
&lt;script type="text/javascript"&gt;&lt;!--

function pop(page){
window.open(page, "newwin", "height = 400, width = 600, left=100, resizeable = no, top=100");
}

//--&gt;&lt;/script&gt;

Edit: In the button code, the forums have split up the word JavaScript into two separate words, so don't just copy and paste that into your code, you'll have to change it back to JavaScript first.
Copy linkTweet thisAlerts:
@samelauthorApr 16.2004 — Thank you so much! It worked!!

Samel
Copy linkTweet thisAlerts:
@David_HarrisonApr 16.2004 — Happy to help. ?
×

Success!

Help @samel spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...