Solved

Handle print  dialog box

Posted on 2001-06-14
4
391 Views
Last Modified: 2012-05-05
Hi,

Is it possible to make print dialog box modal? Without clicking on OK or Cancel, User should not be allowed to navigate further.

Thanks in advance.

0
Comment
Question by:surkh
  • 3
4 Comments
 
LVL 4

Expert Comment

by:jcs_clement
ID: 6194406
Is is what u are looking for ?

<html>
<script>
function callfun(){
    x = confirm("Do u want to continue ?")
    if(x){
          alert(" do something " )
       }
    else{
          alert( "do something else " )
      }
}
</script>
<body>
<input type="button" value="click" OnClick="callfun()">
</body>
</html>

rgds
jcs
0
 
LVL 4

Expert Comment

by:jcs_clement
ID: 6194413
Or is it something to do with the print dialog box
This one can do it is IE 4.0

<html>
<head>
<SCRIPT Language="Javascript">
function printit(){
   var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
   document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
   WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    
  // WebBrowser1.outerHTML = "";
}
</script>
</head>
<body>
This is a print test.
<form>
<input type=button value="Print this Page" name="Print" onClick="printit()">
</form>
</body>
</html>
0
 
LVL 4

Expert Comment

by:jcs_clement
ID: 6194414
Or is it something to do with the print dialog box
This one can do it is IE 4.0

<html>
<head>
<SCRIPT Language="Javascript">
function printit(){
   var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
   document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
   WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    
  // WebBrowser1.outerHTML = "";
}
</script>
</head>
<body>
This is a print test.
<form>
<input type=button value="Print this Page" name="Print" onClick="printit()">
</form>
</body>
</html>
0
 
LVL 1

Accepted Solution

by:
damianosky earned 50 total points
ID: 6194422
For what I know, there is no way to change the state of the dialogs in MSIE and/or Netscape.

In any case, remember that the behaviour is different according to browser version and type, so a solution which works on MSIE 5.x may not be right for 4.x or Netscape equivalent. Nescape 6.0 is an clear example: what goes on Netscape 4.x is not alway supported on Netscape 6...

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now