/    Sign up×
Community /Pin to ProfileBookmark

using same function

well here is the deal. i am going to have 50 different links. each link will open up a picture, they are all going to be the same size. i was going to use 50 different functions with these paramaters::

function my_win()
{
window.open(‘page.html’,’nameofwindow’,’width=125,height=150,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no’);
}

then i thought, there had to be a more efficient way of doing it. i want to know if it was possible to have one function for 50 different links, if i just used a list of arrays. i tried it out, but it didn’t work how i did it. maybe you guys could help me by just posting an example. if you could that would be very useful. thanks.

tylor

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@pyroFeb 23.2003 — Something like this, maybe?

function my_win(src,windowname)
{
window.open (''+src+'',''+windowname+'','width=125...');
}


and where you call your function, do it like this

my_win("yourpage.htm","yourwindowname")
×

Success!

Help @thindery 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.16,
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,
)...