I am having a problem with the prompt message being blocked by popup blockers. (I think)
I have the following javascript code on my page and some customers are having a problem with the prompt message. They get the confirm message and answer yes and then it immedietly puts up the message "Approval Process cancelled". Other customers are fine.
I figure this is due to popup blockers on thier box. This is what I have tried and nothing seems to fix it on this box.
1. Enable popups on the page.
2. Clear temp files and cookies
3. Hold Ctrl key when doing the approval
4. Allow the web site under the pop-up blocker in the internet tools. (In the privacy setting tab)
Nothing seems to work. They can go to another machine and it allows them to approve but I need to find out what is stopping it on this machine.
The asp page calls a javascript function that contains the following codewhen a button is clicked. - if (confirm("Are you sure you wish to APPROVE this property?") == false)
-
{
-
return;
-
}
-
-
var answer = prompt("Please enter your First Name, Last Name and Title.","");
-
-
if (answer == null)
-
{
-
// cancel
-
alert("Approval Process cancelled");
-
return;
-
}
-
I would appreciate any help
2 2539 acoder 16,027
Recognized Expert Moderator MVP
The problem is IE7 has disabled prompt by default. Either change the settings on each browser or use an alternative - here's one.
There are easier ways, including a hidden input field on your page.
Nothing completely mimics a window.prompt, but you can come close with
something like this- customise the style to suit. -
// Start with an object to hold a couple methods
-
-
if(typeof Run!= 'object')Run={};
-
-
// event handler method
-
Run.addEve= function(who,what,fun){
-
if(who.addEventListener) who.addEventListener(what,fun,false);
-
else if(who.attachEvent) who.attachEvent('on'+what,fun);
-
}
-
-
// faux prompt:
-
Run.prompter= function(str1,str2,callback){
-
// first insert a layer to overlay the page-
-
// the prompt isn't truly modal, but mouse events are blocked
-
// until you deal with the prompt.
-
-
var isIE= !document.addEventListener && document.attachEvent;
-
var sy= document.documentElement.scrollTop ||
-
document.body.scrollTop;
-
var py= screen.height+sy;
-
-
var P1= document.createElement('div');
-
var sty= {position:'absolute',top:'0px',left:'0px',
-
width:'100%',height:py+'px',
-
zIndex:'1000000000',backgroundColor:'white'};
-
-
if(isIE) sty.filter= 'alpha(opacity=10)' ;
-
else sty.opacity= '.2';
-
-
for(var p in sty) P1.style[p]= sty[p];
-
P1.id= 'modalDiv';
-
document.body.appendChild(P1);
-
-
// create the prompt div
-
var elDiv= document.createElement('div');
-
elDiv.id= 'promptDiv';
-
sty= {position:'absolute', top:(100+sy)+'px',left:'25%',width:'30em',
-
border:'2px ridge black',backgroundColor:'#ddd',color:'black',
-
zIndex:'1000000001',paddingBottom:'1em'};
-
-
for(var p in sty) elDiv.style[p]= sty[p];
-
var el= document.createElement('h3');
-
el.appendChild(document.createTextNode(str1));
-
elDiv.appendChild(el);
-
-
// input and buttons
-
el= document.createElement('p');
-
elDiv.appendChild(el);
-
var elT= document.createElement('input');
-
elT.type= 'text';
-
elT.size= '24';
-
elT.value= str2 || '';
-
el.appendChild(elT);
-
var elB= document.createElement('button');
-
elB.appendChild(document.createTextNode('OK'));
-
el.appendChild(elB);
-
var elB2= elB.cloneNode(false);
-
elB2.appendChild(document.createTextNode('Cancel'));
-
el.appendChild(elB2);
-
-
// remove it (after callback)
-
var zap= function(){
-
setTimeout(function(){
-
document.body.removeChild(
-
document.getElementById('promptDiv'));
-
document.body.removeChild(
-
document.getElementById('modalDiv'));
-
},
-
250);
-
}
-
// assign handlers- enter key will work as well as mouse click
-
if(typeof callback== 'function'){
-
Run.addEve(elB,'click',function(){ callback(elT.value) });
-
}
-
Run.addEve(elB,'click',zap);
-
Run.addEve(elB2,'click',zap);
-
document.body.appendChild(elDiv);
-
elT.focus();
-
}
// test case- arguments: prompt text, default input, callback function Run.prompter('T ype a value','',funct ion(tem){alert( tem)}); Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Shaun McKinnon |
last post by:
HI...Here's my problem...I have a popup window that loads when i want it to,
but it's not sized properly. I've set the size, but it doesn't seem to
work. I've been on 8 different websites to find out what i'm doing wrong,
and so far it seems i'm doing it the right way. Here's my code...any
suggestions would be appreciated.
<script...
|
by: Dan |
last post by:
First, I'm sorry if this question has been asked
too many times. I'm new to this news group.
The question has to do with the use of popup
windows in a web page. I have heard that popup
windows should be avoided; due to use of popup
blockers and browser that do not process javascript.
Is the use of popup windows bad design?
Will it...
|
by: Bijoy Naick |
last post by:
It seems like the BBC sports site is able to get past popup blockers..
For eg.. http://news.bbc.co.uk/sport1/hi/cricket/default.stm. Click on
the Video icon under "Watch and Listen" - right hand frame.
I have a popup blocker installed but the window still pops up.. Any
one know how this can be done?
BTW: I need this functionality for an...
|
by: Robert Oschler |
last post by:
We like to pop-up context help windows when a user clicks on certain terms
on our web pages. However, the popup blockers seem to block any links with
"target=_new" or "target=_blank". Is there a way with Javascript to open a
new window that is acceptable to the popup blockers? These context help
windows are a direct result of a user click,...
|
by: |
last post by:
So many websites can get around my Googlebar's popup blockers. Even Opera 8
can not stop those popups. I looked into the codes, and I can find nothing
showing me how it is done. Can anyone help me find what how it is done?
First go to
http://www.sitepoint.com/forums/showthread.php?t=184025&page=1&pp=25
Click on
Last ? on the page
| |
by: Chris Ianson |
last post by:
Hi, I have this JavaScript, which I only want to occur if a user clicks on a
hyperlink hotspot in a large image:
<script type="text/javascript">
<!--
var answer = confirm ("This link is not available, click OK to load a
similar link, or Cancel to not.")
if (!answer)
window.location="http://www.yahoo.com/"
// -->
|
by: vickeybird |
last post by:
I want to know if it is possible to detect if Pop up Blocker is enabled
without trying to open a Pop Up windows.
I'm trying to create a web analytics script and visible Pop up in case
of disabled PopUp Blocker is not being accepted.
|
by: dd |
last post by:
I have a scenario where my popups are being blocked
by IE6+ and Firefox. The problem is that although the
popup is a direct result of the user clicking on the link
(meaning that they WANT the popup), when it comes
to opening it, I'm doing it via a JavaScript function and
by the time the popup is opened the browser doesn't
know it was as a...
|
by: Greg Taylor |
last post by:
Greetings,
I was wondering if there was a way to make prompt() calls in Safari
show a single-line input box instead of the default multi-line prompt
that it currently does.
It seems like most other browsers just provide a single-line prompt
text box, meaning that the user hitting ENTER is the same as them
hitting the "Ok" button. In...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |