Dialog Box in Javascript

plz tell me how to make a dialog box in javascript .

var Dialog=cc.Node.extend({
ctor:function(p,won){
this._super();
this.mymain=p;
this.enable=false;
var winSize = global_winSize;

if(won)
{
    var sp1 = cc.Sprite.create("res/01.png");
    sp1.setPosition(cc.p(winSize.width/2,winSize.height/2));
    this.addChild(sp1, 0, -1);
    var help2=cc.LabelTTF.create("挑战2048成功!","Arial",40);
    this.addChild(help2);
    help2.setPosition(cc.p(240,400));
}
else
{
    var sp1 = cc.Sprite.create("res/06.png");
    sp1.setPosition(cc.p(winSize.width/2,winSize.height/2));
    this.addChild(sp1, 0, -1);
    var help2=cc.LabelTTF.create("已经无法移动,触摸继续。","Arial",40);
    this.addChild(help2);
    help2.setPosition(cc.p(240,400));

}

this.runAction(cc.Sequence.create(
cc.DelayTime.create(1),
cc.CallFunc.create(this.func1, this)));
},
func1:function()
{
this.enable=true;
},
onEnter:function()
{
cc.registerTargetedDelegate(-100, true, this);
this._super();
},
onExit:function()
{
cc.unregisterTouchDelegate(this);
this._super();
},
onTouchBegan:function (touch, event) {
cc.log(“touch begin”);
if(this.enable)
{
this.mymain.removeChild(this);
this.mymain.restart();
}
else
{
cc.log(“delay”);
}
return true;
},
});

This link should help you:

This code was very easy & helpful to create a beautiful dialog box.
Thanks Mr.Navjot