Solved

Handle print  dialog box

Posted on 2001-06-14
4
392 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

776 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