#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    Tallinn, .ee
    Posts
    28
    Rep Power
    0

    Unhappy javascript confirm() and window.print()...plz help


    Here is my problem ...
    I have a page, thats ask visitor to print this page or not.
    If visitor clicks OK, browser print dialog is appeared, and after printing there is appearing new one confirm() function, that doing redirect on other page.

    Problem: when I click IN BROWSER PRINT DIALOG BUTTON "CANCEL"- all OK, function gar() is calling and appearing confirm() function.
    But if I click IN BROWSER PRINT DIALOG BUTTON "PRINT" , browser prints page AND gives me 2 (TWO!!) confirmations at one time: "Print?" and "Do u want make warranty?"
    I have a javascript that looks like this:
    ---------------------------------------------------
    if (confirm("Print?"))
    {
    window.print();
    gar();
    }
    else
    {
    window.close();
    }


    function gar() {
    if (confirm("Do u want to make warranty?"))
    {
    document.myForm.submit();
    }
    else
    {
    window.location.href = "cash.jsp"
    }
    }
    -------------------------------------
    plzzz help...
  2. #2
  3. An Ominous Coward
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2002
    Posts
    4,425
    Rep Power
    0
    Not sure I understand.

    As I understand it:

    When someone comes to your page, they get the confirm box to Print.
    If they click OK, the document prints, then they get the Print dialog again and at the exact same time get the "Warranty" dialog? My best guess:

    Try doing this:

    PHP Code:
    function gar() { 
    if (
    confirm("Do u want to make warranty?")) 

    document.myForm.submit(); 
    [
    COLOR=RED]return false;[/COLOR]

    else 

    window.location.href "cash.jsp" 


    Honestly, I don't think that extra return false will do anything. I'm having a hard time following what you want to do though. Please post some additional explanation.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    Tallinn, .ee
    Posts
    28
    Rep Power
    0

    to Ctb...


    Thx a lot for ur reply, but Im already solved this problem, by choosing another way of printing etc...
    Anyway Thx..

IMN logo majestic logo threadwatch logo seochat tools logo