Solved

Handle print  dialog box

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
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…

708 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

12 Experts available now in Live!

Get 1:1 Help Now