/    Sign up×
Community /Pin to ProfileBookmark

Calling Two Functions

I am trying to call two functions in my script, but it will only call one or the other. Any help?

[code=php]<script type=”text/javascript”>
function showPopUp(el) {
var cvr = document.getElementById(“cover”)
var dlg = document.getElementById(el)
cvr.style.display = “block”
dlg.style.display = “block”
if (document.body.style.overflow = “hidden”) {
cvr.style.width = “100%”
cvr.style.height = “100%”
}
}
function showPopUp1() {
window.open(‘http://www.freeseamlesstiles.com/mailcode18/index.php’, ‘newwin’, ‘width=500,height=500,resizable=no,scrollbars=no,toolbars=no,location=no,directories=no,status=no,menubar=no,copyhistory=no’);
}
function bothcalls() {
showPopUp(el)
showPopUp1(el)
}
</script>[/code]

And I call with:

[code=php]<a href=”#” onclick=”bothcalls()”><img src=”/_gfx/add.gif” border=”0″ alt=”add tile” align=”left”> Add a Tile</a>[/code]

It will not work this way. But if I use:

[code=php]<a href=”#” onclick=”showPopUp(‘el’)”><img src=”/_gfx/add.gif” border=”0″ alt=”add tile” align=”left”> Add a Tile</a>[/code]

or

[code=php]<a href=”#” onclick=”showPopUp1()”><img src=”/_gfx/add.gif” border=”0″ alt=”add tile” align=”left”> Add a Tile</a>[/code]

It will work and only call that one function.

The first function darkens the screen while the second brings up a popup.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Apr 18.2008 — [code=php]var dlg = document.getElementById(el) [/code] requires that you pass an argument to that function. When there is no argument, as in the first example, it will not work.[code=php]function bothcalls() {
showPopUp("el")
showPopUp1()
} [/code]
[code=html]<a href="#" onclick="showPopUp()"><img src="/_gfx/add.gif" border="0" alt="add tile" align="left"> Add a Tile</a> [/code] should work.
×

Success!

Help @Becca800 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...