Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie-Javascript Modal Box

    Newbie question.

    I've read through the javascript section and wasn't able to find any threads on this issue (really hoping I didnt' overlook and now am reposting same question...my apologies if I am).

    Question - Is it possible to change what verbage gets displayed in a javascript modal box title tag.

    Thank you for any help.

    NB

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    posted http://www.eggheadcafe.com/articles/...dal_dialog.asp
    Code:
    <html>
    <script language=JavaScript>
     
    var ModalDialogWindow;
    var ModalDialogInterval;
    var ModalDialog = new Object;
    
    ModalDialog.value = '';
    ModalDialog.eventhandler = '';
     
    
    function ModalDialogMaintainFocus()
    {
      try
      {
        if (ModalDialogWindow.closed)
         {
            window.clearInterval(ModalDialogInterval);
            eval(ModalDialog.eventhandler);       
            return;
         }
        ModalDialogWindow.focus(); 
      }
      catch (everything) {   }
    }
            
     function ModalDialogRemoveWatch()
     {
        ModalDialog.value = '';
        ModalDialog.eventhandler = '';
     }
            
     function ModalDialogShow(Title,BodyText,Buttons,EventHandler)
     {
    
       ModalDialogRemoveWatch();
       ModalDialog.eventhandler = EventHandler;
    
       var args='width=350,height=125,left=325,top=300,toolbar=0,';
           args+='location=0,status=0,menubar=0,scrollbars=1,resizable=0';  
    
       ModalDialogWindow=window.open("","",args); 
       ModalDialogWindow.document.open(); 
       ModalDialogWindow.document.write('<html>');
       ModalDialogWindow.document.write('<head>'); 
       ModalDialogWindow.document.write('<title>' + Title + '</title>');
       ModalDialogWindow.document.write('<script' + ' language=JavaScript>');
       ModalDialogWindow.document.write('function CloseForm(Response) ');
       ModalDialogWindow.document.write('{ ');
       ModalDialogWindow.document.write(' window.opener.ModalDialog.value = Response; ');
       ModalDialogWindow.document.write(' window.close(); ');
       ModalDialogWindow.document.write('} ');
       ModalDialogWindow.document.write('</script' + '>');        
       ModalDialogWindow.document.write('</head>');   
       ModalDialogWindow.document.write('<body onblur="window.focus();">');
       ModalDialogWindow.document.write('<table border=0 width="95%" align=center cellspacing=0 cellpadding=2>');
       ModalDialogWindow.document.write('<tr><td align=left>' + BodyText + '</td></tr>');
       ModalDialogWindow.document.write('<tr><td align=left><br></td></tr>');
       ModalDialogWindow.document.write('<tr><td align=center>' + Buttons + '</td></tr>');
       ModalDialogWindow.document.write('</body>');
       ModalDialogWindow.document.write('</html>'); 
       ModalDialogWindow.document.close(); 
       ModalDialogWindow.focus(); 
       ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",5);
    
     }
    
    </script>
    
    <script language=JavaScript>
    
    
      function YesNoCancel(BodyText,EventHandler)
      {
         var Buttons=''; 
         Buttons = '<a href=javascript:CloseForm("Yes");>Yes</a>  ';
         Buttons += '<a href=javascript:CloseForm("No");>No</a>  ';
         Buttons += '<a href=javascript:CloseForm("Cancel");>Cancel</a>  ';
         ModalDialogShow("My Custom Title",BodyText,Buttons,EventHandler);
      }
     
     function YesNoCancelReturnMethod()
     {
       document.getElementById('modalreturn1').value =  ModalDialog.value;
       ModalDialogRemoveWatch();
     }
    </script>
     
    <BODY >
    
      <table border=1 cellpadding=2 cellspacing=2 align=center width="60%">
        <tr><td align=left></td></tr>
        <tr><td align=left></td></tr>
        <tr><td align=left></td></tr>
        <tr>
    	   <td align=left><a href="javascript:YesNoCancel('Yes, no, or cancel me','YesNoCancelReturnMethod()');">Show Modal #1</a>   
              1. <input type=text id=modalreturn1 name=modalreturn1 value=''></td>
      	</tr>
      </table>
    
    </BODY>
    </HTML>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •