Click here to Skip to main content
14,641,690 members
Rate this:
Please Sign up or sign in to vote.
See more:
function hello()
{
   call();
   alert("hello");
}
function call()
{
  alert("call");
}


in the above code , i just want the browser to execute alert("call") not alert("hello").

any help
thanks in advance
Posted
Updated 8-May-13 9:38am
v2
Comments
Zoltán Zörgő 8-May-13 15:31pm
   
Than don't ad that alert.
[no name] 8-May-13 15:50pm
   
See Solution-1 below and be polite.
Rate this:
Please Sign up or sign in to vote.

Solution 1

Well, then remove or comment out alert("hello"); don't forget to call either of these functions at the point where there are already declared (that it, below).

—SA
   
Comments
[no name] 8-May-13 15:38pm
   
To the point answer, 5ed.
   
Thank you, Rais.
Not difficult for anyone, right? :-)
—SA
[no name] 8-May-13 15:42pm
   
yup, probably OP had a half-sleep last night, :).
bhawin parkeria 8-May-13 15:52pm
   
yup
i didn't slept last night.

do you guys have girlfriend?
   
Have a best of luck, man. (OK, are you accepting the answer formally (green button?))
—SA
bhawin parkeria 8-May-13 16:13pm
   
i m sorry for my bad language
but the question is good,
   
It depends on what do you call "good" :-)
I was good enough for me to answer it, but I advice to formulate questions like formal questions. We are too much overwhelmed by non-questions, they cause big irritation...
—SA
Rate this:
Please Sign up or sign in to vote.

Solution 2

function hello()
{
call();
if(call())
{
alert("hello");
}
}

function call()
{
alert("call");
return true;
}


the alert("hello") will be called only when the call() will return true
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100