I have a popup window that I need to display based on the user’s responses in a form. The popup window is called by:
[CODE]
win=window.open(cnfpage,cnfname,settings);
I would like the popup window to look like this:
[code=html]
<body background=”Graphics/bg-website.gif”>
<div id=”customConfirmBox”>
<center><p>
<script>document.writeln(“There will be a ” + rate + “% surcharge for using PayPal (Total charge = $” + final + “).<p>Please click the Accept button to authorize this charge.<p>Otherwise click the Decline button.<p>”)</script>
<p><input type=”button” onclick=”answer(true)” value=”Accept”>
<input type=”button” onclick=”answer(false)” value=”Decline”></p>
</div>
</body>
The values of [I]rate[I]final
Also, I will need to pass which button is clicked back to the parent.
Can anyone help me with this please.
var sWin;
window.onload = function()
{
sWin = window.open('./page.htm');
alert(sWin.document.title);
sWin.location.href = 'http://google.com/';
<i> </i>try {
<i> </i> alert(sWin.document.title); // cannot access this...
<i> </i>} catch (e) {
<i> </i> alert('Cannot access document.title in other window.');
<i> </i>}
}
[code=html]<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Order Form</title>
<style>
#customConfirmBox{ /* adjust margins, colors, etc. as necessary */
position:fixed;
top:25%;
left:25%;
width:350px;
border:solid 1px #f0e68c;
padding:5px;
border-radius:10px;
box-shadow: 10px 10px 5px #888;
display:none;
}
</style>
<script>
function show(box){
box.style.display='block';
}
function answer(ans,box){
// do your other stuff here
box.style.display="none";
}
</script>
</head>
<body>
<button onclick="show(customConfirmBox)">PayPal info</button> <!-- this can be triggered from anywhere, not necessarily a button -->
<div id="customConfirmBox">
<p><script>document.write("There will be a % surcharge for using PayPal.<br>(Total charge = $).")</script></p> <!-- Add " + rate + " and " + final + " where appropriate. No comment on document.write :) -->
<p>Please click the Accept button to authorize this charge.
<p>Otherwise click the Decline button.")</p>
<p><input type="button" onclick="answer(true,customConfirmBox)" value="Accept">
<input type="button" onclick="answer(false,customConfirmBox)" value="Decline"></p>
</div>
</body>
</html>[/code]
if (confirm("There will be a " + rate + "% surcharge for using PayPal (Total charge = $" + final + ").nnPlease click the OK button to authorize this charge.nnOtherwise click the CANCEL button.")) {
// they clicked ok
} else {
// they clicked cancel
}
confirm(
'Accept Paypal Surcharge?',
'<p>There will be a ' + rate + '% surcharge for using PayPal.</p><p><span class="keepTogether"><b>Product Total:</b> $' + total.toFixed(2) + '</span> &bull; <span class="keepTogether"><b>Total Charge:</b> $' + (total * (rate + 100) / 100).toFixed(2) + '</b></span></p><p>Please click the Accept button to authorize this charge.<br />Otherwise click the Decline button.</p>',
alert
);
var data = {
title : 'dialog title',
message : '<p>Your message markup</p>',
buttons : [ 'Yes', 'No', 'Cancel' ],
resultFunction
};
[CODE]Speaker: <a href="" onclick="getPayment();return false" onfocus="this.blur()">Click here</a> to learn about our special speaker.[/CODE]
[CODE]<script>
function getPayment(){
message = "Noted author, lecturer and button collector<p>Peggy Ann Osborne<p>Program will be presented via Skype from her home in Nova Scotiann";
confirm('Special Guest Presenter',message,getResults);
}
function getResults(results){return false}
</script>
[/CODE]
handlerAdd(confirmPaypal, 'click', function(e) {
confirm(
'Accept Paypal Surcharge?',
/*
NOTE - this is one of the times JavaScript's lack of whitespace
neutral strings REALLY pisses me off
*/
'<p>There will be a ' + rate + '% surcharge for using PayPal.</p><p><span class="keepTogether"><b>Product Total:</b> $' + total.toFixed(2) + '</span> &bull; <span class="keepTogether"><b>Total Charge:</b> $' + (total * (rate + 100) / 100).toFixed(2) + '</b></span></p><p>Please click the Accept button to authorize this charge.<br />Otherwise click the Decline button.</p>',
alert
);
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
}, true, true);
0.1.9 — BETA 5.18