How to write JavaScript function like prompt/confirm -


this question has answer here:

i want write javascript function prompt() or confirm() line execution wait until mentioned function returned anything.

say, have function abc() open popup , return value. want hold execution function called.

    function abc(){       ----------       return '';     }      function abc_caller(){        var x = abc();        alert(x);     } 

can please me regarding this?

your code should -

function abc_caller(){        var x = abc();        var r=confirm("your value " + x);        if (r==true)        {           alert("you pressed ok!")        }        else        {           alert("you pressed cancel!")       }     } 

more examples in http://www.w3schools.com/jsref/met_win_confirm.asp.

hope you.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -