popup dialog (webplayer and client compatible)


1) Put this markup on a HTML
<div style='display:none' id="dialog">  
   <p>put a document property here</p>
</div>
<span id='myAlertButton1' style='border:3px outset gray;background:whitesmoke' >show dialog</span>
<span id='myAlertButton2' style='border:3px outset gray;background:whitesmoke' >create dialog</span>

2) Add this script

//tell buttons what to do when clicked
$("#myAlertButton1").click(showDialog)
$("#myAlertButton2").click(createDialog)

//uses dialog from markup. Useful when mixing document properties in markup. Will show only once if clicked multiple times
function showDialog(){
   //change the title attribute since we can't in html editor
   $("#dialog").prop({title:'test'}).dialog();
}

//no need to have hidden dialog html markup, but creates many dialogs when clicking multiple times
function createDialog(){ 
   $("<div/>").prop({   
      title:'Important!',
text:'hello world',
innerHTML:'<b>hello</b> world!'  
   }).dialog();
}

    Previous
    Next Post »