hi, as the title has saiad, if the user click "ok" for exp it will link to www.google.com and if the user click "cancel" it will link to www.yahoo.com.

below is my code

function calcFunc(){
    var val1 = document.calcForm.selectQuantity1.selectedIndex;
	var val2 = document.calcForm.selectQuantity2.selectedIndex;
	var val3 = document.calcForm.selectQuantity3.selectedIndex;
	var val4 = document.calcForm.selectQuantity4.selectedIndex;
	var val5 = document.calcForm.selectQuantity5.selectedIndex;
	var val6 = document.calcForm.selectQuantity6.selectedIndex;

	if (document.calcForm.selectQuantity1.selectedIndex != 0 || document.calcForm.selectQuantity2.selectedIndex != 0
		|| document.calcForm.selectQuantity3.selectedIndex != 0 || document.calcForm.selectQuantity4.selectedIndex != 0
		|| document.calcForm.selectQuantity5.selectedIndex != 0 || document.calcForm.selectQuantity6.selectedIndex != 0){
    var amt = (49.0 * (val1+val2+val3+val4+val5+val6));
    document.write(ConfirmChoice(amt))
	}
}
//Comfirm Function
function ConfirmChoice(answer)
{	
answer1 = confirm("Your total is RM" + answer + "\nProceed to the payment site?");
if (answer1!="1")
{
window.location="http:\\www.google.com";
}
else 
{
window.location="TShirt.html";
}
}

>> Line 13 - The function does not return anything. Use:

ConfirmChoice(atm);

>> The ConfirmChoice function -

- Each webadress begins with http:// not http:\\
- You forgot var in front of answer1
- Confirm returns true or a false, although they are equal to 1 and 0, better use the true/false

The function complete:

function ConfirmChoice(answer)
{	
var answer1 = confirm("Your total is RM" + answer + "\nProceed to the payment site?");
if (answer1 == true)
{
window.location.href="TShirt.html";
}
else 
{
window.location.href="http://www.google.com";
}
}

~G

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.