Create Popup on Icon (image) Click

  •  07-13-2006, 2:22 PM

    Create Popup on Icon (image) Click

    I'm trying to code the editor so that when someone clicks the 'New' icon they get a javascript popup that asks if they really want to clear the document.  I realize they could just hit the 'undo' icon, but you know users aren't that smart sometimes.  If I use the following code, I can easily attach my javascript method to the button...
     
    CType(oCuteEditor.ToolControls("New").Control, System.Web.UI.WebControls.WebControl).Attributes.Add("onclick", "return ConfirmWindow(""Are you sure you want to clear this document??\nSelect 'OK' to delete or 'Cancel' to quit."");")
     
    The problem is that if I add the above 'onclick' event to the image, it no longer functions as a CuteEditor 'New' button, regardless if they select 'ok or 'cancel' in my javascript window.  My javascript window appears, but the editor document doesn't clear.  Is there a way to do this differently?  This works fine for all of my custom pages and any visual studio built-in control.
     
    Here is the Javascript that the above control is attached to.  It returns either true or false.  
     
    <script language="javascript">
    <!--
    function ConfirmWindow(strDialogMessage){
    var strMessage;
    var intResponse;
    intResponse = confirm(strDialogMessage);
    if (intResponse == 1) {
    return true;
    } else {
    return false;
    }
    }
    //-->
    </script>
     
    Thanks in advance,
    Jon
View Complete Thread