Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-02-2013, 02:29 PM   PM User | #1
surendra
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
surendra is an unknown quantity at this point
problem with confirm() in internet explorer

Hi

I am using confirm() message box in java servlets, i am geting problem with popup blocker even i enable the popup blocker.

please guide me to solve this problem.


Thank you.

Regards
Surendra
surendra is offline   Reply With Quote
Old 01-02-2013, 03:03 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,387
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
1. When talking IE it is best to give ver number as they all work differently. I check the below code in IE8 and it works for me.
2. We are in the dark and have to guess if code is not supplied.
3. java servlets is for a different language, java not javascript.

What I check:
Code:
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a confirm box.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x;
var r=confirm("Press a button!");
if (r==true)
  {
  x="You pressed OK!";
  }
else
  {
  x="You pressed Cancel!";
  }
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
4. Such things as confirm boxes, prompt boxes, and alert boxes are not used much in programming anymore except for testing purposes.
sunfighter is offline   Reply With Quote
Old 01-02-2013, 07:28 PM   PM User | #3
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,462
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
confirm() is for debugging use only and is rarely needed even then so it doesn't really matter whether it works or not - it could be deleted from JavaScript now without having any real impact.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 01-02-2013, 08:23 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
As the original poster said, he is getting the problem in JAVA servlets. Not JavaScript. So he is posting in the wrong forum.

I would assume, since he says the JAVA confirm() is being blocked by the popup blocker, that the JAVA confirm is, indeed, using a popup window and has nothing to do with JavaScript's window.confirm( ) method.

See, for example, the various kinds of confirm dialogs noted here:
http://docs.oracle.com/javase/tutori...ts/dialog.html
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

Last edited by Old Pedant; 01-02-2013 at 08:26 PM..
Old Pedant is offline   Reply With Quote
Old 01-03-2013, 06:30 AM   PM User | #5
surendra
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
surendra is an unknown quantity at this point
Hi

thanks for the reply.

but i am unable to understand my prooblem...
please check the below to codes which i am using in two diffrent programs

1) first code is working on same IE

out.println("function popMessage(f)");
out.println("{");
out.println("if(f.chk.checked) ");
out.println(" if(confirm('If you click the Post button now the agreement will be removed from Action List '))");
out.println(" { }");
out.println("else");
out.println("{f.chk.checked=false");
out.println(" }");
out.println("}");

2) Second code is the problem code with popup blocker on IE

out.println(" if( info == '--') ");
out.println(" {");
out.println(" var x= confirm('Für diese Aktion wurden bereits Kosten verbucht. Sind Sie sicher, dass Sie weitere Kosten verbuchen wollen?”');");
out.println("if (x)");
out.println(" {");
out.println("window.open('Costreason.html', '', 'height=350,width=450');");
out.println("window.close();");
out.println(" }");
surendra is offline   Reply With Quote
Old 01-03-2013, 07:28 AM   PM User | #6
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,043
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
As has been pointed out, this is JAVA code so you have posted in the wrong forum. This is the JavaScript forum. Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia! Ask a mod to move this thread to the right forum.

But it is obvious that the problem lies with the literary quotes in

Kosten verbuchen wollen?”');");

That will barf in any browser, not just IE.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 01-03-2013, 08:43 PM   PM User | #7
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Ummm...Philip, although he is using Java to *write* the output, that's just server-side Java.

That server-side Java *IS* creating JavaScript, correctly.

Specifically, the second set of Java code is producing *this* client-side JavaScript for the browser:
Code:
if( info == '--') 
{
    var x = confirm('Für diese Aktion wurden bereits Kosten verbucht. Sind Sie sicher, dass Sie weitere Kosten verbuchen wollen?”');
    if ( x ) 
    {
        window.open('Costreason.html', '', 'height=350,width=450');
        window.close();
    }
}
It is true that he has a bogus "literary quote" mark in there, as shown in the large red text, but that won't hurt anything as it will be ignored by JavaScript (and Java, incidentally) and only the subsequent apostrophe will be used, correctly.

As shown, the code is missing one closing right brace } as I have indicated, but since he says the code works in browsers other than IE, it's probably really there in the actual code.

I really think he may be right, that his is a problem with a popup blocker.

********

On the other hand, the code also doesn't make tons of sense.

He opens the popup window for 'Costreason.html' but then *CLOSES* the CURRENT WINDOW. Why? If you only want one window to remain open, just *replace* the current window with the new one.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

Last edited by Old Pedant; 01-03-2013 at 08:47 PM..
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:02 AM.


Advertisement
Log in to turn off these ads.