/    Sign up×
Community /Pin to ProfileBookmark

Calling function in a function

not sure if such method is possible.

function run1()
{
if(parent.topFrame.document.formname.submitbutton == true)
{
function run2();
}

}

function run2()
{
if statement code here
}

what i am trying to do is. when the button onclick, then it executes a function. it doesn’t work. maybe I got the syntax wrong or something.

or is there a better way to do it?
onclick, executes a ‘if else statement function’

thank you in advance

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@chaosecretsSep 28.2006 — Hi limecity. s u can call a function in a function. as u r callin function run1() on onclick event of the button then there is no need to again verify tht. if u want to verfiy again then u assign a variable some value onclick and then check if tht is true in ur run1(). n also if u r doin nothin in ur run1() then u can call run2() itself directly.

for ex., u call run1() like this...

<input type="button" id="submitbutton" onclick="run1();">

//then there wil b no need of this

"if parent.topFrame.document.formname.submitbutton == true)"

if u want to verify then u hav to do it like this

<input type="button" id="submitbutton" onclick="somevariable.value='true'; run1();">

then u check if tht somevariable is true in run1() n continue wit ur code....

if u r stil not clear lemme know ?
Copy linkTweet thisAlerts:
@limecityauthorSep 28.2006 — it worked ! it worked ! it worked !

:-D discovering something new everyday !

thank you chaosecrets !

i used the code you show me

<input type="button" id="submitbutton" onclick="somevariable.value='true'; run1();">

:-D
×

Success!

Help @limecity 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.19,
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,
)...